https://github.com/purescript-react/purescript-react-basic-dom
https://github.com/purescript-react/purescript-react-basic-dom
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/purescript-react/purescript-react-basic-dom
- Owner: purescript-react
- License: apache-2.0
- Created: 2020-05-28T20:52:07.000Z (almost 6 years ago)
- Default Branch: main
- Last Pushed: 2024-11-08T17:04:52.000Z (over 1 year ago)
- Last Synced: 2025-04-13T17:11:59.929Z (about 1 year ago)
- Language: PureScript
- Homepage: https://pursuit.purescript.org/packages/purescript-react-basic-dom
- Size: 676 KB
- Stars: 12
- Watchers: 8
- Forks: 20
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# purescript-react-basic-dom
[](https://github.com/lumihq/purescript-react-basic-dom/actions/workflows/ci.yml)
This library contains the [React Basic](https://github.com/lumihq/purescript-react-basic) DOM modules.
## Example
```purescript
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](https://github.com/JordanMartinez/purescript-cookbook/tree/master/recipes).