Can I dispatch an action in reducer?

Dispatching an action within a reducer is an anti-pattern . Your reducer should be without side effects, simply digesting the action payload and returning a new state object. Adding listeners and dispatching actions within the reducer can lead to chained actions and other side effects.

Sizin İçin Seçtik  How do you use state variables in React?

Leave a Reply

Your email address will not be published. Required fields are marked *