withAction
Higher-Order Components for dispatching an action, when component is about to mount.
The action will receive the location and the match from react-router.
withAction(action) is useful, when you want to start running side-effects in the Epics right after Component being rendered.
Arguments
action(string): Redux Action to dispatch.
Returns
(Function): A Higher-Order Component, which dispatches an Action, when Component is mounted.
Example: Dispatching an Action, before the About component is rendered.
./src/containers/About
./src/containers/Aboutimport { withRouterAction } from '@react-observatory/with-action'
import About from './About'
export default withAction('About')(About)Last updated