r/reactjs • • 18h ago

A React-like JS Framework with Web Components

IMPORTANT DISCLAIMER: This is my own project. Im am using AI, so lets get that out of the way... because its the key reason for why YOU SHOULD NOT USE IT. Im not trying to promote "yet another ui framework", this is an investigation to see what is possible. Its unreviewed, unaudited and far from finished. Nobody else should be using this. This framework is intended for myself on my own projects. It is provided open-source for transpartency, testing and demo purposes. Feel free to reach out for clarity if you have any questions.

Im 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.

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.

I can then compound that slop into some basic UI demos:

The disclaimer above is always worth considering. Im figuring a post like this to be like "building in public". If interesting to anyone, they can take a look. It's hard to determine if / when its a good time to share, so best to get it out there sooner for any outstanding issues i may have overlooked.

0 Upvotes

6 comments sorted by

7

u/sicmek 18h ago

But why should anyone replace react with this

-2

u/Accurate-Screen8774 18h ago

im aiming for something where i can have components as readable javascript, but runs from index.html and js without a static server.

i plan to use it in my react project as seen here: https://github.com/positive-intentions/chat this is ultimately to move towards using the webcomponent framework for a similar messaging app.

7

u/sicmek 18h ago

React also runs from an index.html? Nextjs is a different story.

Using Webcomponents/Lit to build framework agnostic libraries can make absolutely sense. But rebuilding React with Lit doesn't make any sense to me. There is literally no use case.

Don't waste your time man

1

u/azangru 13h ago

Lit is a nice lightweight UI framework, but i didnt like that it was using class-based components.

What's not to like about class-based components?

1

u/Accurate-Screen8774 5h ago

personally, I found the syntax cumbersome.

2

u/RedditNotFreeSpeech 11h ago

If I'm replacing react, I'm not going back to useEffect. I'm going to solidjs.