This library contains the React Basic DOM modules.
importPreludeimportData.Maybe (Maybe(..))
importEffect (Effect)
importEffect.Exception (throw)
importReact.Basic.DOM.Client (createRoot, renderRoot)
importReact.Basic.DOM (text)
importWeb.DOM.NonElementParentNode (getElementById)
importWeb.HTML (window)
importWeb.HTML.HTMLDocument (toNonElementParentNode)
importWeb.HTML.Window (document)
main::EffectUnit
main = do
doc <- document =<< window
root <- getElementById "root" $ toNonElementParentNode doc
case root ofNothing-> throw "Could not find container element"Just container ->do
reactRoot <- createRoot container
renderRoot reactRoot (text "Hello")More examples can be found in the PureScript Cookbook.