withAction

Higher-Order Componentsarrow-up-right for dispatching an action, when component is about to mount.

The action will receive the locationarrow-up-right and the matcharrow-up-right from react-router.arrow-up-right

withAction(action) is useful, when you want to start running side-effects in the Epics right after Component being rendered.

Arguments

  1. action (string): Redux Actionarrow-up-right to dispatch.

Returns

(Function): A Higher-Order Componentarrow-up-right, which dispatches an Action,arrow-up-right when Component is mounted.

Example: Dispatching an Action,arrow-up-right before the About component is rendered.

./src/containers/About

import { withRouterAction } from '@react-observatory/with-action'
import About from './About'

export default withAction('About')(About)

Last updated