-
Notifications
You must be signed in to change notification settings - Fork 6
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
🔷 [Epic] Hooks support (excludes advanced hooks) #23
Comments
Support for hooks in general should be possible, though I haven't been able to sort out the issues yet. The current implementation relies on a custom Preact bundle into which a function call is injected into the The issue seems to revolve around a I did try to rebuild the custom bundle with hooks as a core dependency, but the error was the same so I am not convinced it's an issue with library interop as most reported issues would suggest. Next steps will be to debug using non-minified bundles to trace the issue and understand the larger problem. In theory there's nothing stopping us from attempting our own hooks implementation but I don't think this should be discussed until the underlying issue here is understood. 🙂 It is possible that this is the indication that inlining the Preact bundle in the iframe container is not a viable solution and requires a more sophisticated approach to intercepting (P)React renders. |
A prerequisite to getting hooks or any other Preact extensions (i.e. signals) to work is to have a stable reference to the options export from Preact... The most likely cause for this to error out would be by having multiple Preact instances in your bundle. Inlining Preact into an Putting this into practice, you have an inlined Preact however if you now want to add hooks it would need to use the export from that bundle. An alternative would be to use a CDN to supply you with the code or use the |
@JoviDeCroock thank you for taking the time to look at the code and weigh in on this! Your comments helped me figure out how to stop abusing the library and better utilize |
|
Support Preact hooks e.g.
useEffect
anduseState
Tasks
The text was updated successfully, but these errors were encountered: