Frontend/React
[React] map
joy_95
2021. 8. 16. 18:58
1 map
배열 안의 모든 자료에 똑같은 작업을 하나씩 시켜주고 싶을 때 사용하는 내장 함수
import React from 'react';
import Header from '../layout/Header';
import Footer from '../layout/Footer';
function Info({text}){
return(
<div>{text}</div>
)
}
const textInfo = [
{text : "WE PROVIDE"},
{text : "VISUAL CODING"},
{text : "SOLUTIONS"},
{text : "FOR YOU WEBS"}
]
function Main(){
return(
<div id="wrap">
<Header/>
<section id="mainCont">
<div className="main__cont">
{textInfo.map((el) => (
<Info text={el.text}/>
))}
</div>
</section>
<Footer/>
</div>
);
}
export default Main;
반응형