아래 코드에서 버튼을 눌러 setState가 호출되면 어떻게 리렌더되는지 살펴보자.
import { useState } from 'react'; function Link() { return <a href="https://yeolyi.com">yeolyi.com</a>; } export default function App() { const [count, setCount] = useState(0); return ( <div> <p> <Link /> <br /> <button onClick={() => setCount((count) => count + 1)}> click me - {count} </button> </p> </div> ); }
로그인 중...