Skip to content

Add el helper - #47

Merged
mjrussell merged 2 commits into
purescript-react:mainfrom
sigma-andex:add-el-helper
Dec 20, 2022
Merged

Add el helper#47
mjrussell merged 2 commits into
purescript-react:mainfrom
sigma-andex:add-el-helper

Conversation

@sigma-andex

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

Looks good! Appreciate the doc comments

@mjrussell
mjrussell merged commit a598a32 into purescript-react:main Dec 20, 2022
@sigma-andex
sigma-andex deleted the add-el-helper branch December 20, 2022 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants