How display image from local JSON / JS Object using React

I have found a solution that worked for me.
These are the steps:

  1. Turn the json file to a JavaScript file (i.e. Change the file extension from .json to .js).

  2. Export the data (export const data = [‘this will be your objects’])

  3. Add require and default to the image property ({image: require(‘Your image path’).default}).

  4. Lastly, import the data file into the file you want to use it.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.