Reading class 22 - meron-401n14/seattle-javascript-401n14 GitHub Wiki

Hook api

.they let you use state and other React features without writing a class . . You can use the State Hook more than once in a single component :

Example :

function ExampleWithManyStates() { // Declare multiple state variables! const [age, setAge] = useState(42); const [fruit, setFruit] = useState('banana'); const [todos, setTodos] = useState([{ text: 'Learn Hooks' }]); // ... }

Hooks are functions that let you "hook into" react state and lifecycle features from function components . Hooks don't work inside classes - they let you use React without classes.