- 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
);
};
'리액트 기기기초' 카테고리의 다른 글
#3.3 Recap (0) | 2023.03.04 |
---|---|
#3.2 setState part Two (0) | 2023.02.28 |
#3.0 Understanding State (0) | 2023.02.27 |
#2.6 JSX part Two (0) | 2023.02.27 |
#2.5 JSX (0) | 2023.02.27 |