React

#3.1 setState part One

김예나 2023. 2. 27. 23:26

배열할당방법

  • 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
        );
    };