Closed Glinkis closed 4 years ago
Thank you for your suggestion! I was thinking about that just yesterday and if you dig deeper you’ll discover that dispatch
is essentially useContext(…).store.dispatch
. Contexts are not inherently static, you can literally change the store at runtime in this specific case, and adding them to the “known static values” would produce extremely obscure bugs.
Let me close the issue as wontfix for these reasons, and reopen it if you think I got something wrong.
I'm pretty sure the
useDispatch
hook in thereact-redux
package returns a referentially equal value every time, so it should be safe to omit it from the dependency arrays.Here is the source for this hook.