@joeroddy/use-derived-state
v1.0.2
Published
Updates derived state when props update
Downloads
3
Readme
use-derived-state
Keep your derived state up to date when props change
Setup
npm install @joeroddy/use-derived-state
Usage
import useDerivedState from '@joeroddy/use-derived-state';
const MyComponent = ({ countFromParent }) => {
const [childCount, setChildCount] = useDerivedState(countFromParent);
return <div>{childCount}</div>;
};