-
-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement hooks without using hooks #199
base: main
Are you sure you want to change the base?
Conversation
|
✅ Deploy Preview for preact-signals-demo ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Size Change: +106 B (0%) Total Size: 67.2 kB
ℹ️ View Unchanged
|
This PR reimplements
useSignal()
,useComputed()
anduseEffect()
without usingpreact/hooks
. This should offer some performance advantages, because the three hooks we provide can all be implemented using the same very simple "indexed slot" mechanism, effectively an inline implementation of theuseMemo
hook.There are some possible drawbacks here though: I don't know if this will mess up DevTools, and it's possible it would make Prefresh's job more difficult (though I also wonder if it gives Prefresh a useful way to differentiate between Signals and Hooks?).