3 ms·
Ive probably been doing it wrong, but isn't useEffect needed to make any hooks work? useState does nothing most of the time
by 8note 2y ago
Ive probably been doing it wrong, but isn't useEffect needed to make any hooks work? useState does nothing most of the time
- kaoD 2y agohttps://react.dev/learn/you-might-not-need-an-effect https://react.dev/learn/you-might-not-need-an-effect
- recursive 2y agoNo. `useState` returns the value of the state, and a setter. It's not about side effects, it's about the value. The returned setter triggers a re-render. That's not nothing.