spread syntax
nested component : A compoent inside B component
import Avatar from './Avator.js';
function Card ( { children } ) {
return (
<div className="card">
{children}
</div>
);
}
export default function Profile () {
return (
<Card >
<Avator size={100} person = { {name: 'Kato', imageID : 'dd'} } />
</Card>
);
}
참조https://react.dev/learn/passing-props-to-a-component
'나의 FE피봇이야기 > React' 카테고리의 다른 글
[useNavigate] useParams() & useLocation() (0) | 2024.02.06 |
---|---|
[function]onClick={handleOnClickDetail(data) vs onClick={()=>{handleOnClickDetail(data)}} (0) | 2024.02.06 |
[arrow function]3가지 기본 이해 (0) | 2024.02.02 |
[useRef]기본 (0) | 2024.02.02 |
[Element&Component] (0) | 2024.02.02 |