11월 27, 2022의 게시물 표시

Publish to my blog (weekly)

Using the State Hook – React A Hook is a special function that lets you “hook into” React features. For example, useState is a Hook that lets you add React state to function components. Normally, variables “disappear” when the function exits but state variables are preserved by React. If we wanted to store two different values in state, we would call useState() twice. State variables can hold objects and arrays just fine, so you can still group related data together. However, unlike this.setState in a class, updating a state variable always replaces it instead of merging it. Hooks at a...