Compile JSX to custom element (reactive) lifecycles #69
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.
-
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.
-
Beta Was this translation helpful? Give feedback.
-
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.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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