-
Notifications
You must be signed in to change notification settings - Fork 8
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
Support different VDOM implementations #8
Comments
Also support React |
Is there a way to use Karet with preact without having to use preact compat? |
Karet doesn't need Preact combat. Here is a JSBin that uses Karet with Preact. I have a some work I'd like to complete on Partial Lenses, but after that I'll look into making a new version of Karet with an attempt to make it more easily parameterized with respect to the VDOM implementation. |
Thanks @polytypic ! I'm considering calmm for one project I'm working on that has a requirement not to use a transpiler, which means I can't use JSX. Luckily I'm only targeting the latest gen browsers. I've had some great success with hyperx which replaces JSX with template literals. I created a minimal working example of Karet / Calmm + Preact + hyperx that doesn't require babel/JSX. Pretty cool! The only hacky bit is the You might want to check out hyperx when it comes to parameterizing the vdom impl. It "works with virtual-dom, react, hyperscript, or any DOM builder with a hyperscript-style API: |
I think some of the bundlers allow you to rename or alias packages. One way to parameterize Karet might be by relying on such a renaming technique. I'm not sure yet how easily/well that would work. Thanks for the parameterizing tip. I haven't yet settled on any specific way to do that. Note that the approach taken by hyperx, namely turning the module into a function, has the problem that it makes dead code elimination difficult. Specifically, in Karet, there is more than one export and not all of the exports are necessarily always used. If Karet is turned into a single function that returns an object, dead code elimination of unused Karet parts becomes more difficult (by which I mean that none of the popular/general purpose alternatives is able to do it and likely will not be able to do it any time soon). |
BTW, I recently simply used the |
Even now, Karet essentially just works with Preact in addition to React. Karet only uses
createElement
andComponent
and assumes thatComponent
s support (componentWillReceiveProps
(is not strictly required),)componentWillMount
,componentWillUnmount
,render
andforceUpdate
methods (ReactsetState
is not used). It would be nice to make Karet directly configurable or parameterized with respect to the VDOM library. Suggestions on how to best expose such configurabilty or parameterization are welcome!The text was updated successfully, but these errors were encountered: