
- setState를 사용하려면 면저 할당을 해야 함
function App () {
const [counter, modifier] = React.useState(0);
return(
<div>
<h3>Total clicks: {counter}</h3>
<button>Click me</button>
</div>
);
}
const App = () => {
const [counter, modifier] = React.useState(0);
return (
component
);
};'React' 카테고리의 다른 글
| #3.3 Recap (4) | 2023.03.04 |
|---|---|
| #3.2 setState part Two (3) | 2023.02.28 |
| #3.0 Understanding State (2) | 2023.02.27 |
| #2.6 JSX part Two (2) | 2023.02.27 |
| #2.5 JSX (1) | 2023.02.27 |