1

I have images inside the public folder and want to render them inside my app. But instead of importing them one by one and then put them into an array, how can I put them straight away into the array without importing them, so the importing list won't get longer as I put more images?

Before :

import Pizza from '../../public/pizza.png';
import Burger from '../../public/burger.png';
import Ramen from '../../public/ramen.png';
import Macaron from '../../public/macaron.png';
import Pie from '../../public/pie.png';
import Salad from '../../public/salad.png';

    
const foodShowcase = [ Pizza, Burger, Ramen, Macaron, Pie, Salad ];

0 Answers0