daljit
daljit

Reputation: 1266

redux, redux-thunk and re-render UI in theory

I am using redux, and redux-thunk and react in my project, This is not actual code but simplified version of code, so may be some syntax errors, but question is more about how it should work.

I have react wrapper using react-redux connect.

In my actions I am using redux-thunk as following -

return function (dispatch, state) {
      dispatch(oneAction);
      dispatch(secondAction);
      dispatch(thirdAction);
}

UI only render after thirdAction, which is good, but I could not figure out what tells the system that now render UI, as I am not returning data after thirdAction.

Thanks

Upvotes: 0

Views: 129

Answers (1)

Luke Vella
Luke Vella

Reputation: 746

Dispatching the action alone does not update the UI.

First, a reducer must listen to the dispatched actions and update the state of your application in the store.

Then, Your components (or views) must subscribe to the store and update their local state when the store is updated.

Upvotes: 1

Related Questions