Could we memoise the bind function? #481
Unanswered
adamledwards
asked this question in
Ideas
Replies: 1 comment 1 reply
-
It's been a long time, I can re-investigate why I made that choice. I know I tried to memo at some point but it had some side effects. The first one being that it would freeze state values, although we could add a third dependency argument to the hook. That would be a breaking change though. But I think there were some other collaterals involving config, I'd have to investigate. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello first of all this is such a great library, thank you.
I also wanted to see if it was a feasible idea to hold memoise the function created by Function.prototype.bind.
My reason is it could be used by apps to use the memo function in their components.
use-gesture/packages/react/src/useRecognizers.ts
Lines 45 to 47 in dc731a0
In the snipped below, if the bind function was true in a strict equality test, the GestureComponent could skip the rerender.
This would be useful in a large list of elements that use gesture event handlers.
Beta Was this translation helpful? Give feedback.
All reactions