Skip to content

Latest commit

 

History

History
12 lines (8 loc) · 317 Bytes

use-compare.md

File metadata and controls

12 lines (8 loc) · 317 Bytes

useCompare

Tracks the value of the given argument from a previous render, then returns a boolean indicating whether that value has changed based on a strict equality check.

Example

const [state, setState] = useState();

const didStateChangeSinceLastRender = useCompare(state);
// => true | false