Skip to content
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

Add Preact support #781

Closed
devongovett opened this issue Jul 18, 2020 · 6 comments
Closed

Add Preact support #781

devongovett opened this issue Jul 18, 2020 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@devongovett
Copy link
Member

🙋 Feature Request

It would be nice to support Preact in addition to React. Preact supports most of the features we need, and is considerably more lightweight, so it would be nice to support it for applications that need to be super slim. Things should mostly already work I think, but there may be places where we rely on React specific features like the synthetic event system. We should try to abstract that.

💁 Possible Solution

  • Test things out and see if they work. Maybe create a demo app aliasing react -> preact and see what breaks.
  • Add the ability to run the test suite against Preact in addition to React to prevent future breakages.
  • Fix the issues. Adjust code as needed to ensure we're compatible with both implementations.
  • Figure out how to release this. Do we want to require people to have an alias in their app? Do we want to create a completely separate set of packages that switch react for preact? Should we abstract things so you could inject an implementation for where to get hooks like useState/useEffect/etc. from? That might allow even more implementations that support the hooks API in the future (e.g. Haunted). How do other libraries handle this?

🧢 Your Company/Team

RSP

@devongovett devongovett added enhancement New feature or request help wanted Extra attention is needed labels Jul 18, 2020
@green-arrow
Copy link

Added this into a fresh preact-cli application, and the only react related warning I get is about flushSync. Looks like someone already created an issue for it as well: preactjs/preact#2636

@devongovett
Copy link
Member Author

Which components did you try? Last I tried, I had issues with Picker and some of the other collections components because of differences in the way Preact handles "key". Also I think I'd expect some differences due to the synthetic event system, eg focus bubbling in React but not in the DOM.

@mischnic mischnic self-assigned this Aug 21, 2020
@green-arrow
Copy link

Sorry I never replied here, completely lost track of it. When I ended up trying a picker component I got some errors like you said.

Definitely looking forward to this issue getting worked on though!

@devongovett
Copy link
Member Author

@mischnic has been working on it. I believe we ran into a few bugs that he's reported so waiting on resolution of those at the moment. But getting closer! 😊

@mischnic mischnic removed their assignment Oct 6, 2020
@devongovett
Copy link
Member Author

Here's a list of issues we ran into if anyone is interested in helping here. Some have been filed with the Preact team, and some may require workarounds on our side.

https://gist.github.com/mischnic/15d81e667cda5c6fa7ab60d0bc77d34b

@dannify
Copy link
Member

dannify commented Apr 1, 2024

Closing as stale. This is not work that the team is able to take on in the near future.

@dannify dannify closed this as not planned Won't fix, can't repro, duplicate, stale Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants