-
Notifications
You must be signed in to change notification settings - Fork 95
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
vanjs-jsx fixes #329
base: main
Are you sure you want to change the base?
vanjs-jsx fixes #329
Conversation
When the *children* and *ref* properties don't exist in the properties object, destructuring initialize those variables to *undefined*. If the given *jsxTag* is a function (a component declared by the user), passing those properties make the resulting HTML element have those attributes rendered but with no value.
@cqh963852, FYI |
@damienflament does this fix also help with the Fragment error? |
@thednp No. I just started using Vite and JSX on my VanJS app. But I have some place where I put elements on a I read your ticket #324 about the missing Fragment implementation. I will take a look later. |
@damienflament question: will the jsx runtime support custom VanJS components? EG: |
@thednp Actually, that's how I use it. MyComp() {
return <div>Some text</>
} <MyComp />
// transformed by the parser to:
jsx(MyComp) In vanjs-jsx, jsx() is aliased to createElement(). Because MyComp is your custom function, it is called with properties as parameters. But this function is also transformed by the parser: MyComp() {
return jsx("div", {children: "Some text"})
} Now, createElement() is called with a tag name. The tag is created using van.tags as usual. |
Thank you @damienflament for the explanation, how's the fix coming in? When can we test? |
@@ -0,0 +1 @@ | |||
export * from "./index"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be fixed by adjusting the configuration of package.json.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this file may cause the vscode editor's smart import to carry a special path.
For example
import {} from "van_jsx/jsx_runtime";
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The whole point of this framework to actually be the smallest of all. I like the way you used it decrease the access time. Keep it up.
@Tao-VanJS / @damienflament any news on these changes please? |
I'm waiting for @cqh963852's approval for this PR. |
In my tests, only the fragment modification is needed. But the entire thing needs to be updated to React 19 jsx. If nothing happens here, I will add this feature into my |
Fixes #325, #328 and other issues.