Install bs-webapi
npm install --save bs-webapi
Add the entry to bsconfig.json
"bs-dependencies": ["bs-webapi"],
use the following snippet
open Webapi.Dom
open Belt
document
->Document.asHtmlDocument
->Option.flatMap(document => document->HtmlDocument.body)
->Option.map(body => {
let root = document->Document.createElement("div", _)
root->Element.setId("app")
// ReactDOM.render(<App />, root) // if you are using react
root->Element.appendChild(body)
})
->ignore
Top comments (0)