Fork me on GitHub
#reagent
<
2022-03-24
>
Christopher Gsell13:03:46

I’m having trouble with the image tag in Reagent. I’m using shadow as my build tool. To use an image in the same folder as my namespace, all I have to do is: [:img {:src “./img.png”}] right? When I do this, in the dev tools it says: GET http://localhost:3449/img 404 (Not Found) Any help is much appreciated.

p-himik14:03:39

Well, is the image at the right location on the server? As long as the URL itself is correct, any HTTP 404 error is neither a Reagent problem nor a CLJS one.

1
oxalorg (Mitesh)14:03:57

> To use an image in the same folder as my namespace This is not how it will work. Shadow's dev server will load asset files from the public folder. The above will only render an html lik eos: <img src "./img.png"> so you need to have the correct file in public/<url-path>/img.png

👍 2
Christopher Gsell14:03:05

Oh man thank you so much

😊 1
Christopher Gsell17:03:16

Has anyone attempted to use an iframe tag with reagent and shadow? I've done so and get a compilation failed error with “invalid assignment target” given for the url address

p-himik17:03:31

What exactly is your code?

Christopher Gsell17:03:43

When I was copying code to you, I noticed I had some legacy url import messing things up. All fixed! Thanks for the response.

👍 1