S
S
Sergey2019-09-18 16:24:13
JavaScript
Sergey, 2019-09-18 16:24:13

React redux multiple actions at the same time how?

Actually, you need to update the state of the Redux store to a certain state, there are several actions for this. They can be called sequentially as follows:
this.props.ChangeReportDetailShowAction(value);
this.props.ChangeReportChildActiveAction(value);
this.props.ChangeReportActiveAction(value);
this.props.ChangeMapCenterAction(value);
But at the same time, all components that subscribe to these values ​​in Redux will twitch through componentWillUpdate, etc. 4 times the same.
Is there a way to update the state at once, as if 4 actions would fire at the same time?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2019-09-18
@disappearedstar

If react-redux is v7 then try https://react-redux.js.org/api/batch
If below then google redux batch actions

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question