hey guys, it's a super stupid question, but.. How ...
# javascript
w
hey guys, it's a super stupid question, but.. How do I add an image in react/kotlin? I've added a png in the jsMain/resources folder but it can't be found at runtime, and it's not present in the build/js bundle
✔️ 1
t
bundle located in
build/distributions
w
sorry, I meant that it's not present in the build folder, I'm not bundling for release, I'm running "jsBrowserDevelopmentRun" and it's searching the image in build\js\packages\KaMPKit-shared\kotlin-dce-dev
it could be that I totally wrong imported it tho, I only found this example:
Copy code
@JsModule("src/resources/baseline_check_circle_empty_black_48dp.png")
external val circleEmpty: dynamic
t
Do you want to bundle images inside bundle?
w
I just want to add an image to the dom for now
sorry if the question was confusing
t
Don’t worry 🙂 Question is normal
Could you use
src/jsMain/resources
dir for resources? It will be processed automatically
w
Yep, I've added the image there, in the same folder with the index.html file
how would I import that image to be used in react then?
t
Via
url
img(src = "/baseline_check_circle_empty_black_48dp.png")
w
great, it works! thanks 🙂
😉 1