Closed Traveller23 closed 11 months ago
When scopes change the state changes. enableScope
and disableScope
are memoized based on the state. When the state changes useCallback
has to reevaluate, so these two functions get recreated. I don't know of any way around that.
Got it. I'll think of something else.
Hi, I'm using version 4.4.1.
When I write
const {enableScope, disableScope} = useHotkeysContext();
in a component, I thought it shouldn't cause the component to re-render because all I need is two methods and they don't change. But the reality is that onceHotkeysContext.enabledScopes
changes, it will cause all components that useuseHotkeysContext()
to re-render.There's an issue from last year which says this has been fixed in version 4.0.8, but I'm still having this problem. Am I not finding the right way to use it, or are these actually two similar but different issues?