How to add another variable in with the string?

I reacte almost not fumble and maybe I not correctly formulated a question.

4Av3omTKBLE.jpg
dojltOpRO5s.jpg

There is a "variable" which is jam-Packed of info, I for one unit to do several of these in the column?Whether to another "term"? only with a different name?Or as that one is upihnut?
April 3rd 20 at 17:42
2 answers
April 3rd 20 at 17:44
Solution
Hi!

First, data of type { title, term } you can put into an array and create components promopays the array, it will be easier and less code.
Second, no one bothers you `term` to make an object or an array.

Maybe I don't quite understand what you want, in this case, describe clearly or pseudocode
I will be grateful if prompt as it saletag - birdie80 commented on April 3rd 20 at 17:47
April 3rd 20 at 17:46
Solution
Here need more knowledge does not react, and objects.
Here's what you give to the data parameter you give in the object title and term.
In fact inside the component TrainBox2 you need to access them via the props parameter.data

You can in the data object to create another object (e.g. term2) then inside will be handling props.data.term2
<TrainBox2 data={{title=" something text", term : "some term", term2 : "some house 2"}} />

inside
<div className="one_floor_top">
 <div className="floor_big">{props.data.title}</div>
 <div className="floor_small">{props.data.term}</div>
 <div className="floor_big">{props.data.title}</div>
 <div className="floor_small">{props.data.term2}</div>
</div>


Or you can create another parameter toga inside already treat as props.data2.term
<TrainBox2 
 data={{title=" something text", term : "some term"}} 
 data2={{title=" something text", term : "some term"}}
/>

inside
<div className="one_floor_top">
 <div className="floor_big">{props.data.title}</div>
 <div className="floor_small">{props.data.term}</div>
 <div className="floor_big">{props.data2.title}</div>
 <div className="floor_small">{props.data2.term}</div>
</div>


PS. no more code - screenshots, this is bad, uncomfortable and wrong, agreed?
Yes, I understand but I do not repeat here this term,term2,term3, etc? How it to push in a array? - birdie80 commented on April 3rd 20 at 17:49
@birdie80, best cycle.
Let's say you have an array of data

const arr = [
{title : 'title1', term : "term1"},
{title : 'title2', term : "term2"},
{title : 'title3', term : "term3"},
{title : 'title4', term : "term4"}
]

and where in the component you return
{arr.map((item, key) => <TrainBox2 
 title={item.title} 
term={item.term}
/>)}
- myrtice commented on April 3rd 20 at 17:52
In your case, maybe even
const arr = [
{title : 'title1', term : { f: '123', s: '123' ...}},
]
- Amalia_Ullrich commented on April 3rd 20 at 17:55

Find more questions by tags React