purescript-react / purescript-react-basic-dom

https://pursuit.purescript.org/packages/purescript-react-basic-dom
Apache License 2.0
11 stars 18 forks source link

Add el helper #47

Closed sigma-andex closed 1 year ago

sigma-andex commented 1 year ago

Add a little el helper function which makes it super easy and compact to use ReactComponents and combine them with the (simplified) html tags:

-- Import the simplified elements
import React.Basic.DOM.Simplified.Generated as R
-- | 
...
-- | 
-- Import your react components, e.g. from NextUI
foreign import container :: forall props. ReactComponent { | props }
foreign import row :: forall props. ReactComponent { | props }
foreign import col :: forall props. ReactComponent { | props }
-- | 
...
-- | 
-- Build your jsx
el container {} $ 
  el row {} $ 
  el col {} $ 
  R.div {} "Some text"
mjrussell commented 1 year ago

Looks good! Appreciate the doc comments