Answer the question
In order to leave comments, you need to log in
How to write a render loop in React?
I have an array with machine data:
export const carData: Icar[] = [
{
name: 'Audi A5',
year: 2007,
src: '../../images/cars/audi.png'
},
{
name: 'BMW 8',
year: 2017,
src: '../../images/cars/bmw.png'
},
{
name: 'Mercedes-Benz C',
year: 2013,
src: '../../images/cars/mers.png'
},
{
name: 'Honda Accord',
year: 2012,
src: '../../images/cars/honda.png'
},
{
name: 'Hyundai Sonata',
year: 2019,
src: '../../images/cars/hyundai.png'
},
{
name: 'Toyota Supra A90',
year: 2019,
src: '../../images/cars/tayota.png'
}
];
import React from 'react';
import { carData } from './carData';
export default function CreateCar() {
for(let i = 0; i < carData.length; i+= 1) {
let name = carData[i].name;
let year = carData[i].year;
let src = carData[i].src;
}
return (
);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question