Is there a guide on how to use <modal component> f...
# javascript
p
Is there a guide on how to use modal component from react-bootstrap in KotlinJs? I think I found a closer answer on stackoverflow but not sure how to add dependency to `react-bootstrap`module. I did
npm install react-bootstrap bootstrap
and the module is installed in
build/js/node_modules/bootstrap
.
h
Don't use npm directly, use
dependencies { implementation(npm("react-bootstrap", version = "0.0.0")) }
p
thanks. that worked.
also dad to add this to my index.html to get it working:
Copy code
<link rel="stylesheet"
          href="<https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css>"
          integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi"
          crossorigin="anonymous"/>

    <script src="<https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js>"
            integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
            crossorigin="anonymous"></script>
h
This should not be needed, just include bootstrap in kotlin and use it somewhere:
Copy code
@JsModule("bootstrap")
internal external val needsJS: dynamic

@JsModule("bootstrap/scss/bootstrap.scss")
internal external val Style: dynamic

fun main() {
  needJS
  Style
}