React.Basic
- Package
- purescript-react-basic
- Repository
- lumihq/purescript-react-basic
#react Source
react :: forall fx state props. { displayName :: String, initialState :: Record state, receiveProps :: Record props -> Record state -> (SetState state fx) -> Eff (react :: ReactFX | fx) Unit, render :: Record props -> Record state -> (SetState state fx) -> JSX } -> ReactComponent (Record props)
Create a React component from a specification of that component.
A specification consists of a state type, an initial value for that state, a function to apply incoming props to the internal state, and a rendering function which takes props, state and a state update function.
The rendering function should return a value of type JSX
, which can be
constructed using the helper functions provided by the React.Basic.DOM
module (and re-exported here).
#createElement Source
createElement :: forall props. ReactComponent (Record props) -> Record props -> JSX
Create a JSX
node from a React component, by providing the props.
#createElementKeyed Source
createElementKeyed :: forall props. ReactComponent (Record props) -> { key :: String | props } -> JSX
Like createElement
, plus a key
for rendering components in a dynamic list.
For more information see: https://reactjs.org/docs/reconciliation.html#keys
#fragmentKeyed Source
fragmentKeyed :: String -> Array JSX -> JSX
Render an Array of children without a wrapping component.
Provide a key when dynamically rendering multiple fragments along side each other.
#ReactComponent Source
data ReactComponent :: Type -> Type
A React component which can be used from JavaScript.