1.0.3 • Published 3 years ago

@artcom/use-selector-once-hook v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Use Selector Once Hook

A react hook for memoizing the redux state on mount time. It povides the state of the store on the first rendering and does not lead to re-render due to state updates. Equivalent to redux useSelector hook, useSelectorOnce expects a selector function as parameter.

Installation

npm i @artcom/use-selector-once-hook --save

Example

import React from "react"
import { useSelectorOnce } from "@artcom/use-selector-once-hook"

const MyComponent = () => {
  const memoizedCounter = useSelectorOnce(state => state.counter)
}

Tests

See tests.

npm i && npm run test
1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago