object entries render component react

Solutions on MaxInterview for object entries render component react by the best coders in the world

showing results for - "object entries render component react"
Roberto
18 Mar 2017
1{
2    areas: ['areaid_0', 'areaid_1', 'areaid_2'],
3    areaDetails: {
4        'areaid_0': {title: 'Some title', isSelected: false},
5        'areaid_1': {title: 'Some title', isSelected: false},
6        'areaid_2': {title: 'Some title', isSelected: false}
7    }
8}
9When it comes to rendering you can do like,
10
11this.state.areas.map(x => {
12  const areaDetail = this.state.areaDetails[x];
13  <Component key={x} {...areaDetail}... />
14})
15When you wants to update any object, you can do like,
16
17this.state.areaDetails[x].isSelected = true;