Hook: useState, useEffect
hook series / React v16.8^
“With Hooks, you can extract stateful logic from a component so it can be tested independently and reused.”
- useState
- useEffect
useState
returns a pair: the current state value and a function that lets you update it. You can think of useEffect
Hook as componentDidMount
, componentDidUpdate
, and componentWillUnmount
combined.
source: React Document