私はreactjsを初めて使って、フッタメニューを提供する一連のjsonをループします。reactjs、json、条件付きdivsをループする
は本当に立ち往生*いただきましouterwrapping要件
私はこのようなルックスを再作成する必要があり、マークアップのこの種のためのソリューション。
0インデックスにそう<div class="row">
<div class="main-footer__left">
<div class="row grid__row--offset--30">
<div class="large-45 large-centered columns">
<h2 class="text--uppercase text--light-blue footer-text">Col</h2>
</div>
</div>
</div>
<div class="main-footer__right">
<div class="row grid__row--offset--30">
<div class="large-14 large-offset-5 columns">
<h2 class="text--uppercase text--light-blue footer-text">Col</h2>
</div>
<div class="large-1 columns">
<div class="vert-line--light-blue"></div>
</div>
<div class="large-14 large-offset-5 columns">
<h2 class="text--uppercase text--light-blue footer-text">Col</h2>
</div>
<div class="large-1 columns">
<div class="vert-line--light-blue"></div>
</div>
<div class="large-14 large-offset-5 columns">
<h2 class="text--uppercase text--light-blue footer-text">Col</h2>
</div>
</div>
<div class="row grid__row--offset--30">
<div class="large-15 large-centered columns">
<p class="text--white text--center footer-text">FIXED</p>
</div>
</div>
</div>
</div>
- インデックス1から - - 「左」クラスでCOLをoutwrapする必要がある「正しい」クラス
私の現在の内部の他のすべての項目をラップする必要がありますreactjsコードはこのように見えますが、私はouterwrappersを追加するのに苦労しています。
{
lang.menu.map(function (item, index) {
return (
{
index === 0 ? <div className='main-footer__left' /> : null
}
{/*
<div key={index} className='large-14 large-offset-5 columns'>
<h2 className='text--uppercase text--light-blue footer-text'>{item.title}</h2>
{
item.switch
? <p className='text--white grid__row--offset--15 footer-text'>
{
item.children.map(function (child, j) {
return (
<Link key={j} className={'text--white footer-text transition ' + (props.active_language === child.title.toString().toLowerCase() ? activeLang : alternativeLang)} to={urls[j]}>{child.title}</Link>
)
})
}
</p>
: item.children.map(function (child, j) {
return (
<div key={j} className={(j === 0 ? ' grid__row--offset--15' : '')}>
<Link className='text--white footer-text transition' to={child.link}>{child.title}</Link>
</div>
)
})
}
</div>
*/}
)
})
}
あなたはリアクションには新しくないようです。あなたは、ほぼ1年前の質問に反応しています。 – Chris
まだ学びます。ループ上でこの種の外部ラッピングを作成する最良の方法は何ですか? –
ここに何か提案があります - 実際にはまった –