You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you've got images that are used by several different components, it's a good idea to have them only once in your project and then just require them wherever needed, like this:
If you've got images that are used by several different components, it's a good idea to have them only once in your project and then just
require
them wherever needed, like this:require("../../images/image.jpg")
require("./images/image.jpg")
with these both referencing the same file. This works, as expected.
Similarly, if you're displaying an array of objects, it's nice to be able to do this:
This also works perfectly.
What doesn't work is attempting to combine the two:
This throws an error stating that it
Cannot find module '../../images/image.jpg'
.Why is this?
The text was updated successfully, but these errors were encountered: