...2 [React] id 전달하기 // Examples.jsximport Section from "./Section.jsx";export default function Examples() { ... return ( ... );}위 코드에서 컴포넌트에 있는 id 속성은 스타일 적용 시 필요한 값이다.// Section.jsxexport default function Section({ title, children }) { return ( {title} {children} )} 하지만 에서 넘겨받는 id가 에 적용되진 않는다. 그럼 Section 컴포넌트에 인자로 id 속성을 추가하면 될까?// Section.jsxexport default.. 2024. 7. 21. [React] 리스트 데이터 동적 출력 //data.jsexport const CORE_CONCEPTS = [ { image: componentsImg, title: 'Components', description: 'The core UI building block - compose the user interface by combining multiple components.', }, { ... }, ...import { CORE_CONCEPTS } from "./data.js"; 데이터를 출력하기 위해 4개의 CoreConcept 컴포넌트가 사용되고 있다.만약 4개의 데이터 중 한 개가 사라지면 해당 영역에 빈 내용을 보여줄 것이다.불필요한 반복 코드를 줄여야 한다.데이터 소스가 변경되면 컴포.. 2024. 7. 10. 이전 1 다음 반응형