1

Apparently importing image url from json file doesn't work and gives such an output. But if i import them this way : {require("hardcoded url")} they work but if i use variables like in the image below the image doesn't load up or like : {require(project.image)} then the whole page goes to the background color.

react code: enter image description here json file: enter image description here

OUTPUT: enter image description here

1 Answer 1

1

You can add require() to all image keys in your JSON file.

example :

change : "image": "images/personalewebsite.png",
to : "image": "require('images/personalewebsite.png')"

this is a demo in codesandbox

Sign up to request clarification or add additional context in comments.

1 Comment

thank you so much!!! i also figured out the same solution later that night

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.