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  When should you not use React hooks?

Leave a Reply

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