8

In Redux, there is initial action @@INIT.

Is possible to dispatch another action (in middleware) when this action occurred?

If not, what is best alternative to push action after store is ready?

Jurosh
  • 6,984
  • 7
  • 40
  • 51

1 Answers1

13

According to https://github.com/reactjs/redux/issues/186

@@INIT

  • internal action
  • name of that action may differ in dev mode, so if you use it - it might broke app functionality or automatic reloading
  • to sum-up, this action should not be touched in app codebase

How to push initial Redux actions then?

Without library:

const store = createStore(...);
store.dispatch(...)

In middleware like Redux Saga:

function * initialSaga() {
   yield put({ ... })
}
export default function * root() {
   yield fork(initialSaga);
}
Jurosh
  • 6,984
  • 7
  • 40
  • 51