Module
React.Basic
- Package
- purescript-react-basic
- Repository
- lumihq/purescript-react-basic
#ComponentInstance Source
data ComponentInstance :: Type
Represents the mounted component instance, or "this" in vanilla React.
#component Source
component :: forall state props. { displayName :: String, initialState :: Record state, receiveProps :: { instance_ :: ComponentInstance, isFirstMount :: Boolean, props :: Record props, setState :: SetState state, setStateThen :: SetStateThen state, state :: Record state } -> Effect Unit, render :: { instance_ :: ComponentInstance, props :: Record props, setState :: SetState state, setStateThen :: SetStateThen state, state :: Record state } -> JSX } -> Component (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.
Note: This function relies on React.PureComponent
internally
#elementKeyed Source
elementKeyed :: forall props. Component (Record props) -> { key :: String | props } -> JSX
Like element
, plus a key
for rendering components in a dynamic list.
For more information see: https://reactjs.org/docs/reconciliation.html#keys