Compile JSX to custom element (reactive) lifecycles #69
Closed
thescientist13
started this conversation in
Ideas
Replies: 4 comments
-
JSX would also support this. import Header from './header.js';
import Footer from './footer.js';
class Layout export HTMLElement ?{
...
render() {
return (
<Header/>
<h1>Hello World!</h1>
<Footer/>
)
}
} The compiler would figure it out from the custom element definition and so would turn into import Header from './header.js';
import Footer from './footer.js';
class Layout export HTMLElement ?{
...
render() {
return (
<wc-header></wc-header>
<h1>Hello World!</h1>
<wc-footer></wc-footer>
)
}
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
Made pretty good progress on this in #73 , so going to turn this into an issue and create new discussion to track some of the syntax and feature ideas I'm tracking in the PR. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Follow along with #84 as we carry through on this, but the basic premise for this is already in progress. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In thinking about a different approach, what if #66 was explored through JSX? 🤔
JSX is similar to tagged template literals, but per my understanding, doesn't prescribe a specific implementation. So perhaps this could be used to provide an (optional) development experience, through a render function, that can take JSX and the compiler can unwind that into valid custom element lifecycles. So no VDOM here, it would just be vanilla JS.
Or something like that, the devil is in details and so will want to play around with it, but think I can probably get a prototype whipped up.
Some useful links / references:
Beta Was this translation helpful? Give feedback.
All reactions