React
- Package
- purescript-react
- Repository
- purescript-contrib/purescript-react
This module defines foreign types and functions which wrap React's functionality.
#ReactElement Source
data ReactElement :: Type
A virtual DOM node, or component.
#ReactComponent Source
data ReactComponent :: Type
A mounted react component
#EventHandler Source
data EventHandler :: Type -> Type
An event handler. The type argument represents the type of the event.
#Disallowed Source
type Disallowed = () :: Row Effect
An access synonym which indicates that neither read nor write access are allowed.
#ReactState Source
data ReactState :: Row Effect -> Effect
This effect indicates that a computation may read or write the component state.
The first type argument is a row of access types (Read
, Write
).
#ReactProps Source
data ReactProps :: Effect
This effect indicates that a computation may read the component props.
#MouseEvent Source
type MouseEvent = { pageX :: Number, pageY :: Number }
The type of mouse events.
#EventHandlerContext Source
type EventHandlerContext eff props state result = Eff (props :: ReactProps, refs :: ReactRefs ReadOnly, state :: ReactState ReadWrite | eff) result
A function which handles events.
#Render Source
type Render props state eff = ReactThis props state -> Eff (props :: ReactProps, refs :: ReactRefs Disallowed, state :: ReactState ReadOnly | eff) ReactElement
A render function.
#GetInitialState Source
type GetInitialState props state eff = ReactThis props state -> Eff (props :: ReactProps, refs :: ReactRefs Disallowed, state :: ReactState Disallowed | eff) state
A get initial state function.
#ComponentWillMount Source
type ComponentWillMount props state eff = ReactThis props state -> Eff (props :: ReactProps, refs :: ReactRefs Disallowed, state :: ReactState ReadWrite | eff) Unit
A component will mount function.
#ComponentDidMount Source
type ComponentDidMount props state eff = ReactThis props state -> Eff (props :: ReactProps, refs :: ReactRefs ReadOnly, state :: ReactState ReadWrite | eff) Unit
A component did mount function.
#ComponentWillReceiveProps Source
type ComponentWillReceiveProps props state eff = ReactThis props state -> props -> Eff (props :: ReactProps, refs :: ReactRefs ReadOnly, state :: ReactState ReadWrite | eff) Unit
A component will receive props function.
#ShouldComponentUpdate Source
type ShouldComponentUpdate props state eff = ReactThis props state -> props -> state -> Eff (props :: ReactProps, refs :: ReactRefs ReadOnly, state :: ReactState ReadWrite | eff) Boolean
A should component update function.
#ComponentWillUpdate Source
type ComponentWillUpdate props state eff = ReactThis props state -> props -> state -> Eff (props :: ReactProps, refs :: ReactRefs ReadOnly, state :: ReactState ReadWrite | eff) Unit
A component will update function.
#ComponentDidUpdate Source
type ComponentDidUpdate props state eff = ReactThis props state -> props -> state -> Eff (props :: ReactProps, refs :: ReactRefs ReadOnly, state :: ReactState ReadOnly | eff) Unit
A component did update function.
#ComponentWillUnmount Source
type ComponentWillUnmount props state eff = ReactThis props state -> Eff (props :: ReactProps, refs :: ReactRefs ReadOnly, state :: ReactState ReadOnly | eff) Unit
A component will unmount function.
#ReactSpec Source
type ReactSpec props state eff = { componentDidMount :: ComponentDidMount props state eff, componentDidUpdate :: ComponentDidUpdate props state eff, componentWillMount :: ComponentWillMount props state eff, componentWillReceiveProps :: ComponentWillReceiveProps props state eff, componentWillUnmount :: ComponentWillUnmount props state eff, componentWillUpdate :: ComponentWillUpdate props state eff, displayName :: String, getInitialState :: GetInitialState props state eff, render :: Render props state eff, shouldComponentUpdate :: ShouldComponentUpdate props state eff }
A specification of a component.
#spec' Source
spec' :: forall eff state props. GetInitialState props state eff -> Render props state eff -> ReactSpec props state eff
Create a component specification with a get initial state function.
#ReactClass Source
data ReactClass :: Type -> Type
React class for components.
#getProps Source
getProps :: forall eff state props. ReactThis props state -> Eff (props :: ReactProps | eff) props
Read the component props.
#getChildren Source
getChildren :: forall eff state props. ReactThis props state -> Eff (props :: ReactProps | eff) (Array ReactElement)
Read the component children property.
#writeState Source
writeState :: forall eff access state props. ReactThis props state -> state -> Eff (state :: ReactState (write :: Write | access) | eff) state
Write the component state.
#writeStateWithCallback Source
writeStateWithCallback :: forall eff access state props. ReactThis props state -> state -> Eff (state :: ReactState (write :: Write | access) | eff) Unit -> Eff (state :: ReactState (write :: Write | access) | eff) state
Write the component state with a callback.
#readState Source
readState :: forall eff access state props. ReactThis props state -> Eff (state :: ReactState (read :: Read | access) | eff) state
Read the component state.
#transformState Source
transformState :: forall eff state props. ReactThis props state -> (state -> state) -> Eff (state :: ReactState ReadWrite | eff) Unit
Transform the component state by applying a function.
#createClass Source
createClass :: forall eff state props. ReactSpec props state eff -> ReactClass props
Create a React class from a specification.
#createClassStateless Source
createClassStateless :: forall props. (props -> ReactElement) -> ReactClass props
Create a stateless React class.
#createClassStateless' Source
createClassStateless' :: forall props. (props -> Array ReactElement -> ReactElement) -> ReactClass props
Create a stateless React class with children access.
#handle Source
handle :: forall result state props ev eff. (ev -> EventHandlerContext eff props state result) -> EventHandler ev
Create an event handler.
#createElement Source
createElement :: forall props. ReactClass props -> props -> Array ReactElement -> ReactElement
Create an element from a React class spreading the children array. Used when the children are known up front.
#createElementDynamic Source
createElementDynamic :: forall props. ReactClass props -> props -> Array ReactElement -> ReactElement
Create an element from a React class passing the children array. Used for a dynamic array of children.
#createElementTagName Source
createElementTagName :: forall props. TagName -> props -> Array ReactElement -> ReactElement
Create an element from a tag name spreading the children array. Used when the children are known up front.
#createElementTagNameDynamic Source
createElementTagNameDynamic :: forall props. TagName -> props -> Array ReactElement -> ReactElement
Create an element from a tag name passing the children array. Used for a dynamic array of children.
#createFactory Source
createFactory :: forall props. ReactClass props -> props -> ReactElement
Create a factory from a React class.
#preventDefault Source
preventDefault :: forall a eff. Event -> Eff eff a
#stopPropagation Source
stopPropagation :: forall a eff. Event -> Eff eff a