@technobuddha > react-hooks > React
Hooks
| Name | Type | Description |
|---|---|---|
| useDerivedState | Function | Like useState, but the value is re-initialized from initialValue whenever deps change. Allows both derived (from dependencies) and manual updates. Useful for state that depends on props or other values, but can also be set directly. |
| useHMR | Function | React hook that tracks Hot Module Replacement (HMR) updates in a Vite development environment. |
| useLocal | Function | Provides a mutable value that persists for the lifetime of the component, similar to useRef, but with a convenient setter function like useState. Updating the value does not cause a re-render. |
| useLocalStorage | Function | Similar to React.useState, returns a stateful value and a function to update it. The state value is also saved in localStorage. |
| usePrevious | Function | Tracks the previous value of a variable across renders. |
| useWhyDidIRender | Function | Logs to the console whenever the given component re-renders and its props have changed. Useful for debugging unnecessary or unexpected re-renders during development. |
| useWindowSize | Function | Gets the current window size, including the dimensions of the scroll bars. |