const FOOTER_INFO_LIST = [
{ id: 1, link: 'https://about.instagram.com/', text: '소개', next: '·' },
{ id: 2, link: 'https://help.instagram.com/', text: '도움말', next: '·' },
{
id: 3,
link: 'https://about.instagram.com/blog',
text: '홍보 센터',
next: '·',
},
{
id: 4,
link: 'https://developers.facebook.com/docs/instagram',
text: 'API',
},
{
id: 5,
link: 'https://about.instagram.com/about-us/careers',
text: '채용 정보',
next: '·',
},
{
id: 6,
link: 'https://privacycenter.instagram.com/policy/?entry_point=ig_help_center_data_policy_redirect',
text: '개인정보처리방침',
next: '·',
},
{
id: 7,
link: 'https://help.instagram.com/581066165581870/',
text: '약관',
next: '·',
},
{
id: 8,
link: 'https://www.instagram.com/explore/locations/',
text: '위치',
next: '·',
},
{
id: 9,
link: '#',
text: '위치',
next: '',
},
];
다음과 같이 상수 데이터를 선언하고 아래와같이 활용할 수 있다.
{FOOTER_INFO_LIST.map(infoList => {
return (
<li key={infoList.id}>
<a href={infoList.link}>{infoList.text}</a>
<span>{infoList.next}</span>
</li>
);
})}
fetch(“/data/파일명.json”).then(response=>response.json()).then(result=>setState(result));
fetch('/data/recommendData.json', {
method: 'GET'
})
.then(res => res.json())
.then(data => {
setProductList(data);
});