I am looping through my achievements
props to display a series of divs:
const listItems = this.props.todo.achievements.map((achievement) =>
<div className="cell" key={achievement.id}>
{achievements[achievement.id].label}
</div>
);`
How can I pull the label out of a json I'm importing from a local file?
{
"achievements":[
{
"label":"one",
"id":0
},
{
"label":"two",
"id":1
},
{
"label":"three",
"id":2
},
{
"label":"four",
"id":3
},
{
"label":"five",
"id":4
}]
}
In my root reducer I have my initial state which stores the achievement id
.
If I output {achievement}
, I only get the number. Should I set my intital state to store the label, rather than store it in a local json file?
const initialState = [
{
date: "Fri 1st",
enjoyments: [1,2,3],
achievements: [1,3,2],
id: 0
},
{
date: "Fri 2",
enjoyments: [1,3,2],
achievements: [1,3,2],
id: 1
},