use-combined-reducers icon indicating copy to clipboard operation
use-combined-reducers copied to clipboard

dispatch changes reference on every call.

Open amsterdamharu opened this issue 5 years ago • 1 comments

If I want to to use dispatch in an effect then dispatch is a dependency and since dispatch changes on every call to useCombinedReducers the effect will be called every time.

A stack overflow issue can be found here.

The pull request is here

amsterdamharu avatar Oct 30 '19 12:10 amsterdamharu

This is actually easily solved with the useRef hook. Check the PR for more info, I made a comment there :)

Tsourdox avatar Jun 28 '20 12:06 Tsourdox