helpful-react-hooks

0.2.0 • Public • Published

helpful-react-hooks

Some helpful hooks that I've found myself copying between projects

Install

npm install helpful-react-hooks

Hooks

useClickAway(callback: function, ref)

Callback function is run when the target of the click event is not a child of the ref React component

useHover(ref)

Returns true when the mouse is hovered over the ref component or one of its children, false when it is not hovered

useForceUpdate()

Returns a function that, when called, forces the component to re-render

useOnWindowResize()

Returns [winHeight, winWidth] when the browser window resizes

useSyncWithFluxStores(stores: ReduceStore<any, any>[])

Takes an array of Flux ReduceStores as input. When any of these stores are updated, the component will re-render. Useful for not having to pass store state as a prop through the parent tree.

License

MIT © FullstackSoftwareInnovations

Package Sidebar

Install

npm i helpful-react-hooks

Weekly Downloads

0

Version

0.2.0

License

MIT

Unpacked Size

3.22 kB

Total Files

3

Last publish

Collaborators

  • fullstackinnovations