Skip to content

Enable memoization for useBoundActions.

Latest
Compare
Choose a tag to compare
@sidecus sidecus released this 26 Aug 18:23

Bound actions are called usually from within useEffect or event handlers. Without memoization, when using within useEffect it can trigger unwanted re-rendering if it's added into the dependency list.

To really benefit from memoization, the parameters (named action creators map) should be defined at global scope instead of function scope.
This is documented in the type definitions and readme.