Dispatcher.React
- Package
- purescript-dispatcher-react
- Repository
- doolse/purescript-dispatcher-react
#ReactReaderT Source
type ReactReaderT props state m a = ReaderT (ReactThis props state) m a
The type of all React action handling functions
#ReactLifecycle Source
type ReactLifecycle props state eval eff = RWS eval Unit (ReactSpec props state eff) Unit
The type of React lifecycle methods - Reader Writer State (RWS) with the eval being the Reader type and the ReactSpec being the State type.
#getProps Source
getProps :: forall eff state props m. MonadEff (props :: ReactProps | eff) m => ReactReaderT props state m props
Get the React properties
#getState Source
getState :: forall eff access state props m. MonadEff (state :: ReactState (read :: Read | access) | eff) m => ReactReaderT props state m state
Get the React state
#modifyState Source
modifyState :: forall eff state props m. MonadEff (state :: ReactState ReadWrite | eff) m => (state -> state) -> ReactReaderT props state m Unit
Modify the React state
#unsafeWithRef' Source
unsafeWithRef' :: forall a m eff ref state props. MonadEff (refs :: ReactRefs ReadOnly | eff) m => (ref -> Eff (refs :: ReactRefs ReadOnly | eff) a) -> String -> ReactReaderT props state m (Maybe a)
#emptyHandler Source
emptyHandler :: forall m a. Applicative m => a -> m Unit
an empty event handler
#execHandler Source
execHandler :: forall state props a m eff2 eff. MonadEff eff m => Eff eff2 a -> ReactReaderT props state m a
Run an Eff event handler
#ReactSpecCreator Source
class ReactSpecCreator eval initialstate render props state eff | eval initialstate render -> props state eff where
Members
createSpec :: eval -> initialstate -> (state -> render) -> ReactSpec props state eff
Instances
(ReactInitialState eval initialstate props state eff, ReactRender eval renderer props state eff) => ReactSpecCreator eval initialstate renderer props state eff
#ReactInitialState Source
class ReactInitialState eval initialstate props state eff | initialstate -> state where
Members
createInitialState :: eval -> initialstate -> GetInitialState props state eff
Instances
ReactInitialState eval (ReactState state) props state eff
(FromContext eval (ReactThis props state) r Eff (props :: ReactProps, refs :: ReactRefs (), state :: ReactState () | eff), ReactInitialState eval next props state eff) => ReactInitialState eval (r -> next) props state eff
#ReactRender Source
class ReactRender eval renderer props state eff | renderer -> eff where
Members
createRenderer :: eval -> renderer -> Render props state eff
Instances
ReactRender eval ReactElement props state eff
(ReactRender eval next props state eff, FromContext eval (ReactThis props state) r Eff (props :: ReactProps, refs :: ReactRefs (), state :: ReactState (read :: Read) | eff)) => ReactRender eval (r -> next) props state eff
#createComponent Source
createComponent :: forall eff renderer eval state2 state props. TypeEquals state2 state => ReactSpecCreator eval (ReactState state) renderer props state eff => state2 -> (state -> renderer) -> eval -> ReactClass props
Create a ReactClass with the given state, renderer and action evaluator
#createComponent' Source
createComponent' :: forall eff renderer initialstate eval state props. ReactSpecCreator eval initialstate renderer props state eff => initialstate -> (state -> renderer) -> eval -> ReactClass props
Create a ReactClass with the given initialstate function, renderer and action evaluator
The initialstate function must return it's state value wrapped in the ReactState
newtype
#createLifecycleComponent Source
createLifecycleComponent :: forall eff renderer eval state2 state props. TypeEquals state2 state => ReactSpecCreator eval (ReactState state) renderer props state eff => ReactLifecycle props state eval eff -> state2 -> (state -> renderer) -> eval -> ReactClass props
Create a ReactClass with the given lifecycle, state, renderer and action evaluator
#createLifecycleComponent' Source
createLifecycleComponent' :: forall eff renderer eval initialstate state props. ReactSpecCreator eval initialstate renderer props state eff => (RWS eval Unit (ReactSpec props state eff) Unit) -> initialstate -> (state -> renderer) -> eval -> ReactClass props
Create a ReactClass with the given lifecycle, initialstate function, renderer and action evaluator
The initialstate function must return it's state value wrapped in the ReactState
newtype
#didMount Source
didMount :: forall eff action state props eval. Dispatchable eval (ReactThis props state) action (Eff (props :: ReactProps, refs :: ReactRefs ReadOnly, state :: ReactState ReadWrite | eff) Unit) => action -> ReactLifecycle props state eval eff
A ReactLifecycle for dispatching the componentDidMount
React lifecycle function
#willUnmount Source
willUnmount :: forall eff action state props eval. Dispatchable eval (ReactThis props state) action (Eff (props :: ReactProps, refs :: ReactRefs ReadOnly, state :: ReactState ReadOnly | eff) Unit) => action -> ReactLifecycle props state eval eff
A ReactLifecycle for dispatching the componentWillUnmount
React lifecycle function
#ReactState Source
newtype ReactState s
A newtype to signify the React State Used to denote the state returned from an initial state function
Constructors
Instances
ReactInitialState eval (ReactState state) props state eff
(TypeEquals state state2) => FromContext eval (ReactThis props state) (ReactState state2) Eff (state :: ReactState (read :: Read | access) | eff)
#ReactProps Source
newtype ReactProps p
A newtype representing the React Props Useful in renderers or initial state functions
Constructors
Instances
(TypeEquals props props2) => FromContext eval (ReactThis props state) (ReactProps props2) Eff (props :: ReactProps | eff)
FromContext eval (ReactThis props state) ReactChildren Eff (props :: ReactProps | eff)
#ReactChildren Source
newtype ReactChildren
A newtype representing the React children array Useful in renderers
Constructors
Instances
FromContext eval (ReactThis props state) ReactChildren Eff (props :: ReactProps | eff)
- Modules
- Dispatcher
- Dispatcher.
React
Given an action evaluator, an initial state, and a render function, return a
ReactSpec
.