React.Basic
- Package
- purescript-react-basic
- Repository
- lumihq/purescript-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
#element Source
element :: forall props. ReactComponent (Record props) -> Record props -> JSXCreate a JSX node from a ReactComponent, by providing the props.
See also: ReactComponent, elementKeyed
#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.
See also: ReactComponent, element, React's documentation regarding the special key prop
#ReactComponent Source
data ReactComponent :: Type -> TypeRepresents a traditional React component. Useful for JavaScript interop and FFI. For example:
foreign import ComponentRequiringJSHacks :: ReactComponent { someProp :: String }
See also: element, toReactComponent
#ReactContext Source
data ReactContext :: Type -> Type#createContext Source
createContext :: forall a. a -> Effect (ReactContext a)Create a ReactContext given a default value. Use provider and consumer
to provide and consume context values. Alternatively, use contextProvider
and contextConsumer directly if a ReactComponent is required for interop.
See also: provider, consumer, React's documentation regarding Context
#contextProvider Source
contextProvider :: forall a. ReactContext a -> ReactComponent { children :: Array JSX, value :: a }#contextConsumer Source
contextConsumer :: forall a. ReactContext a -> ReactComponent { children :: a -> Array JSX }