Open YaserMb opened 3 years ago
const items = [ // name key is must. It is to show the text in front {id: 1, name: 'twitter'}, {id: 2, name: 'codepen'}, {id: 3, name: 'envelope'}, {id: 4, name: 'etsy'}, {id: 5, name: 'facebook'}, {id: 6, name: 'foursquare'}, {id: 7, name: 'github-alt'}, {id: 8, name: 'github'}, {id: 9, name: 'gitlab'}, {id: 10, name: 'instagram'}, ];
Above is items object with key as 'id' and 'name' The list which I am getting from API has different key. How do I change that?
I want like this: const items = [ // name key is must. It is to show the text in front {bike_id: 1, bike_number: 'twitter'}, {bike_id: 2, bike_number: 'codepen'}, {bike_id: 3, bike_number: 'envelope'}, {bike_id: 4, bike_number: 'etsy'}, {bike_id: 5, bike_number: 'facebook'}, {bike_id: 6, bike_number: 'foursquare'}, {bike_id: 7, bike_number: 'github-alt'}, {bike_id: 8, bike_number: 'github'}, {bike_id: 9, bike_number: 'gitlab'}, {bike_id: 10, bike_number: 'instagram'}, ];
const items = [ // name key is must. It is to show the text in front {id: 1, name: 'twitter'}, {id: 2, name: 'codepen'}, {id: 3, name: 'envelope'}, {id: 4, name: 'etsy'}, {id: 5, name: 'facebook'}, {id: 6, name: 'foursquare'}, {id: 7, name: 'github-alt'}, {id: 8, name: 'github'}, {id: 9, name: 'gitlab'}, {id: 10, name: 'instagram'}, ];
Above is items object with key as 'id' and 'name' The list which I am getting from API has different key. How do I change that?
I want like this: const items = [ // name key is must. It is to show the text in front {bike_id: 1, bike_number: 'twitter'}, {bike_id: 2, bike_number: 'codepen'}, {bike_id: 3, bike_number: 'envelope'}, {bike_id: 4, bike_number: 'etsy'}, {bike_id: 5, bike_number: 'facebook'}, {bike_id: 6, bike_number: 'foursquare'}, {bike_id: 7, bike_number: 'github-alt'}, {bike_id: 8, bike_number: 'github'}, {bike_id: 9, bike_number: 'gitlab'}, {bike_id: 10, bike_number: 'instagram'}, ];