Add Preact support
See original GitHub issue🙋 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
Issue Analytics
- State:
- Created 3 years ago
- Reactions:12
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Switching to Preact (from React)
Switching to Preact can be as easy as installing and aliasing preact-compat in for react and react-dom . This lets you continue writing...
Read more >Getting Started | Preact: Fast 3kb React alternative with the ...
New to Preact? New to Virtual DOM? Check out the tutorial. This guide helps you get up and running to start developing Preact...
Read more >Switching to Preact (from React)
This is the recommended way to try out Preact if you have an existing React app. This lets you continue writing React/ReactDOM code...
Read more >Getting Started | Preact: Fast 3kb React alternative with the ...
So, we want to have a 1-second timer start once the Component gets added to the DOM, and stop if it is removed....
Read more >Browser Support | Preact
Preact supports modern browsers (Chrome, Firefox, Safari, Edge) and IE11. It works out of the box with these browsers and no additional polyfills...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
@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! 😊