React Observatory
  • Introduction
  • Motivation
  • Dynamic Injection
    • Reducers
    • Epics
  • API Reference
    • applyAsyncEpics
    • applyAsyncReducers
    • composeReducerCreator
    • createRootEpic
    • injectEpic
    • injectReducer
    • withAction
    • withRouterAction
Powered by GitBook
On this page
  • Arguments
  • Returns
  • Example: Dispatching an Action, before the About component is rendered.
  • ./src/containers/About
  1. API Reference

withAction

PreviousinjectReducerNextwithRouterAction

Last updated 6 years ago

for dispatching an action, when component is about to mount.

The action will receive the and the from

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 to dispatch.

Returns

(Function): A , which dispatches an when Component is mounted.

Example: Dispatching an 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)
Higher-Order Components
location
match
react-router.
Action
Higher-Order Component
Action,
Action,