이성열
A

목표

아래 코드가 어떻게 초기 렌더되는지 살펴보자.

import { useState } from 'react';

function Link() {
return <a href="https://yeolyi.com">yeolyi.com</a>;
}

function Component() {
const [count, setCount] = useState(0);
return (

<div>
<button onClick={() => setCount((count) => count + 1)}>
  click me - {count}
</button>{" "}
({count % 2 === 0 ? <span>even</span> : <b>odd</b>})
</div>
); }

export default function App() {
return (
  <div>
    <Link />
    <br />
    <Component />
  </div>
);
}

댓글을 남기려면 로그인이 필요합니다.