React: can't display svg images coming from a json file

Hi I can’t display images that are stored in a json file!

When I’m mapping the json file I have access to the path for the image but they wont display.

I know that i can Import each svg images but I would like to display them in the and to use the link provided in the json file.

My code ;

My html in the console:
Capture d’écran 2021-12-04 à 10.55.03

My json file:

I think you should try to put assets folder inside public folder.
because in browser only public folder is served after build.

I tried your solution, but I still can’t access those svg inside my json.

This is te result that I get:

the dot(.) is causing the problem try removing it from the json file.
https://en.wikipedia.org/static/images/project-logos/enwiki.png

if you have folders in public or static folder let assets
then you can access them using relative path from public/static folder

ex.
src="/static/image.png"

1 Like

Your solution fixed my problem, it’s perfect! I learned something new today thanks to you.

I want to thank you a lot. I spent 2 hours this morning trying to fix this problem and searching for solution on Google.

My pleasure, you tried your best but it was related to Back-End so it was the least I could do.

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