Module
React.Basic.Compat
- Package
- purescript-react-basic
- Repository
- lumihq/purescript-react-basic
This module is deprecated and may be removed in the next major version.
#Component Source
type Component = ReactComponent#component Source
component :: forall state props. { displayName :: String, initialState :: Record state, receiveProps :: { props :: Record props, setState :: (Record state -> Record state) -> Effect Unit, state :: Record state } -> Effect Unit, render :: { props :: Record props, setState :: (Record state -> Record state) -> Effect Unit, state :: Record state } -> JSX } -> ReactComponent (Record props)Supports a common subset of the v2 API to ease the upgrade process
Re-exports from React.Basic
#JSX Source
data JSX :: TypeRepresents rendered React VDOM (the result of calling React.createElement
in JavaScript).
JSX is a Monoid:
append- Merge two
JSXnodes usingReact.Fragment.
- Merge two
mempty- The
emptynode; renders nothing.
- The
Hint: Many useful utility functions already exist for Monoids. For example,
guard can be used to conditionally render a subtree of components.
Instances
#elementKeyed Source
elementKeyed :: forall props. ReactComponent (Record props) -> { key :: String | props } -> JSXCreate a JSX node from a ReactComponent, by providing the props and a key.
This function is for non-React-Basic React components, such as those imported from FFI.
See also: ReactComponent, element, React's documentation regarding the special key prop