-
-
Notifications
You must be signed in to change notification settings - Fork 154
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 support for Hono Client Components #448
Comments
Thanks for the suggestion. I am not familiar with Hono's components yet, could you maybe write your ideas on how this could be implemented? |
Thanks for the interest. We could try to mimic this file https://github.com/molefrog/wouter/blob/v3/packages/wouter/src/react-deps.js (or the preact file) with the same hooks and export everything in wouter/hono? If I take the import coming from React and used in react-deps.
All the thing exist in Hono. I think we should be able to make wouter works for hono. Here the methods coming from Hono. (Sorry for my bad English) |
Thanks, I'll think more about this, right now I don't see a straightforward solution. Maybe you can try importing wouter from a CDN (like esm.sh) with react dependency overriden? Similarly, to what you would do to use convert a React library to Preact? P.S. Your English is fine! I am a non-native speaker myself. |
It's not urgent on my side, I use react right now, I'll migrate to hono/jsx/dom when a solution is ready. When I have some time, I will try your solution. (I didn't know about esm.sh, thank you) |
Hi @molefrog there is a fork of wouter with hono support but the ssrPath is not working. I created an issue here. But I still think the hono package could be part of the wouter package. |
Alright, I did some brief digging and it looks like the problem in this line wouter/packages/wouter/src/index.js Line 183 in fa5f6b1
wouter uses |
I run a quick test and it worked, however there is another issue: Hono can't render components that return |
Can you add more info about the test ? I can create an issue about this point here if needed https://github.com/honojs |
Sure, here is what you can test (these are separate cases):
import { createElement } from "hono/jsx"
const el = createElement("div", { children: <a href="/">Link</a> })
// expected behaviour is the same as in React:
// div with a link in it, instead it just creates a `div` The fix is to pass children as a third argument. We can fix this in wouter's source though, but I think it would make sense to have this behaviour similar to React's. |
Looks like 1) is no longer an issue, it was fixed here honojs/hono#3241 Could you try to update your example and see if this error still occurs with the latest version of Hono? |
Hono has a client components system, and is very similar to React but much more smaller.
https://hono.dev/guides/jsx-dom#client-components
The text was updated successfully, but these errors were encountered: