@artcom/use-selector-once-hook

1.0.3 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

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

Weekly Downloads

3

Version

1.0.3

License

MIT

Unpacked Size

3.17 kB

Total Files

4

Last publish

Collaborators

  • d-lin
  • j-era
  • becks-artcom
  • utileetdulce