A React-like JS Framework with Web Components
A React-like JS Framework with Web Components
I was investigating an idea i had about JSX-like syntax for webcomponents after some experience with Lit. I am sharing this here because it might be interesting/educational. Lit is a nice lightweight UI framework, but i didnt like that it was using class-based components. It can support React with a wrapper, buts React is fundamentally an abstraction away from the DOM. Vue has a nice approach but i prefer working with the syntax that React uses. I find it more intuitive for debugging and deterministic rendering. I wondered if with webcomponents, i could create a UI framework that didnt need to be transpiled. • docs • code • demo My intentions with this framework is to get to a reasonable level of stability, to then replace React on some of my existing projects. I made a start by creating some basic reusable ui components components to be built with the js framework. Aiming for something like Material UI. • code • demo I can then simmer that slop into some basic UI demos: • Shopping app demo • Messaging app demo • Encrypted Notes app demo To better demonstrate the pure javascript approach, i created an example of using a minimal amount of tooling for a PWA. The aim here is to keep the application logic in readable js and abstract the framework logic away from the developer for better DX. • code • demo To simplify things for myself, i added something similar to module-federation where i can fetch the dim dependencies from remote instead of publishing to npm. The approach has tradoffs worth considering and is still a work in progress.
Comments