Module

React.Redux

Package
purescript-react-redux
Repository
ethul/purescript-react-redux

#ConnectClass Source

data ConnectClass :: Type -> Type -> Type -> Type -> Type

Connected class representation parameterized by state, ownProps, props, and action.

#ConnectClass' Source

type ConnectClass' state props action = ConnectClass state (Record ()) props action

Connect class type alias for a class with no ownProps.

#ConnectOptions Source

type ConnectOptions state stateProps ownProps props options = (areMergedPropsEqual :: Fn2 (Record props) (Record props) Boolean, areOwnPropsEqual :: Fn2 (Record ownProps) (Record ownProps) Boolean, areStatePropsEqual :: Fn2 (Record stateProps) (Record stateProps) Boolean, areStatesEqual :: Fn2 (Record state) (Record state) Boolean, pure :: Boolean, storeKey :: String | options)

Options that can be passed on calling connect. Additional options may also be provided as needed.

#connect Source

connect :: forall options'' options' options props stateDispatchProps ownProps dispatchProps stateProps action state eff. Union stateProps dispatchProps stateDispatchProps => Union stateDispatchProps ownProps props => Union options options'' (ConnectOptions state stateProps ownProps props options') => (Record state -> Record ownProps -> Record stateProps) -> (BaseDispatch eff action -> Record ownProps -> Record dispatchProps) -> Record options -> ReactClass (Record props) -> ConnectClass (Record state) (Record ownProps) (Record props) action

Redux connect function that depends on ownProps.

Redux will invoke the mapping functions whenever the connected class receives updated ownProps.

#connect_ Source

connect_ :: forall options'' options' options props dispatchProps stateProps action state eff. Union stateProps dispatchProps props => Union props () props => Union options options'' (ConnectOptions state stateProps () props options') => (Record state -> Record stateProps) -> (BaseDispatch eff action -> Record dispatchProps) -> Record options -> ReactClass (Record props) -> ConnectClass' (Record state) (Record props) action

Redux connect function that does not depend on ownProps.

#createElement Source

createElement :: forall action props ownProps state. ConnectClass (Record state) (Record ownProps) (Record props) action -> Record ownProps -> Array ReactElement -> ReactElement

#createElement_ Source

createElement_ :: forall action props state. ConnectClass' (Record state) (Record props) action -> Array ReactElement -> ReactElement

#createProviderElement Source

createProviderElement :: forall action state eff. ReduxStore eff state action -> Array ReactElement -> ReactElement

#applyMiddleware Source

applyMiddleware :: forall result action state eff. Array (Middleware eff state action action result) -> ReduxStoreEnhancer eff state action

#createStore Source

createStore :: forall action state eff. Reducer action state -> state -> ReduxStoreEnhancer eff state action -> Eff (ReduxEffect eff) (ReduxStore eff state action)

#createStore' Source

createStore' :: forall action state eff. Reducer action state -> state -> Eff (ReduxEffect eff) (ReduxStore eff state action)

Re-exports from React.Redux.Middleware

#MiddlewareAPI Source

type MiddlewareAPI eff state action = { dispatch :: Dispatch eff action action, getState :: Eff (ReduxEffect eff) state }

#Middleware Source

newtype Middleware eff state action a b

Instances

Re-exports from React.Redux.Reducer

#reducerFlipped Source

reducerFlipped :: forall state' state action. (state -> action -> state') -> Reducer action state state'

Re-exports from React.Redux.Types

#ReduxStoreEnhancer Source

type ReduxStoreEnhancer eff state action = ReduxStoreCreator eff state action -> ReduxStoreCreator eff state action

Type alias for a foreign Redux store enhancer, taking a ReduxStoreCreator and returning a ReduxStoreCreator.

#ReduxStoreCreator Source

data ReduxStoreCreator :: Row Effect -> Type -> Type -> Type

Foreign Redux store creator function.

#ReduxStore Source

type ReduxStore eff state action = { dispatch :: ReduxBaseDispatch eff action, getState :: Eff (ReduxEffect eff) state, replaceReducer :: EffFn1 (ReduxEffect eff) (ReduxReducer state action) Unit, subscribe :: Eff (ReduxEffect eff) Unit -> Eff (ReduxEffect eff) Unit }

Type alias for a foreign ReduxStore

#ReduxReducer Source

type ReduxReducer state action = Fn2 state (ReduxAction' (Nullable action)) state

Reducing function that takes a state and ReduxAction and returns a state.

#ReduxMiddlewareAPI Source

type ReduxMiddlewareAPI eff state action = { dispatch :: ReduxBaseDispatch eff action, getState :: Eff (ReduxEffect eff) state }

Simplified Store representation passed to each middleware.

#ReduxMiddleware Source

type ReduxMiddleware eff state action a b = ReduxMiddlewareAPI eff state action -> ReduxDispatch eff action a -> ReduxDispatch eff action b

Function that composes dispatch functions. Purposely restricted to dispatching action types here.

#ReduxEffect Source

type ReduxEffect eff = (redux :: REDUX | eff)

Convenience type alias for the Redux effect.

#ReduxDispatch Source

type ReduxDispatch eff action result = EffFn1 (ReduxEffect eff) (ReduxAction' action) result

Allows ReduxMiddleware to wrap the ReduxBaseDispatch function to return a different result to be passed to the next ReduxMiddleware.

#ReduxBaseDispatch Source

type ReduxBaseDispatch eff action = EffFn1 (ReduxEffect eff) (ReduxAction' action) (ReduxAction' action)

The ReduxBaseDispatch is the dispatching function provided to the store without any middleware.

#ReduxAction' Source

type ReduxAction' action = ReduxAction (action :: action)

Convenience type for converting an action in this module to a ReduxAction.

#ReduxAction Source

type ReduxAction r = { type :: String | r }

Redux actions must be a record with a type field.

#Reducer Source

type Reducer action state = Reducer action state state

Reducer that does not change the type of the state.

#REDUX Source

data REDUX :: Effect

Effect type for Redux.

#Dispatch Source

type Dispatch eff action result = action -> Eff (ReduxEffect eff) result

Dispatching function that returns a result type given an action.

#BaseDispatch Source

type BaseDispatch eff action = Dispatch eff action action

Dispatching function that returns the action it was passed.