Skip to content

Hi-Angel/purescript-react-basic-dom

This branch is 3 commits behind purescript-react/purescript-react-basic-dom:main.

Folders and files

NameName
Last commit message
Last commit date
Jun 18, 2022
Apr 3, 2023
May 18, 2023
Jun 18, 2022
May 24, 2022
Jun 30, 2020
May 24, 2022
Jun 30, 2020
May 24, 2022
Jun 30, 2020
Jun 30, 2020
Jun 30, 2020
Jul 7, 2022
Jul 22, 2022
May 24, 2022
May 24, 2022
Jul 22, 2022
Jul 22, 2022
Jul 22, 2022
Jul 8, 2022
Jun 18, 2022

Repository files navigation

purescript-react-basic-dom

Build Status React Basic DOM on Pursuit

This library contains the React Basic DOM modules.

Example

import Prelude

import Data.Maybe (Maybe(..))
import Effect (Effect)
import Effect.Exception (throw)
import React.Basic.DOM.Client (createRoot, renderRoot)
import React.Basic.DOM (text)
import Web.DOM.NonElementParentNode (getElementById)
import Web.HTML (window)
import Web.HTML.HTMLDocument (toNonElementParentNode)
import Web.HTML.Window (document)

main :: Effect Unit
main = do
  doc <- document =<< window
  root <- getElementById "root" $ toNonElementParentNode doc
  case root of
    Nothing -> 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.

Releases

No releases published

Packages

No packages published

Languages

  • PureScript 98.2%
  • JavaScript 1.5%
  • Other 0.3%