Hacker News new | ask | show | jobs
by kklisura 1465 days ago
I wish people build _native_ JS library first and then framework library wrapper over that, so at least their library can be used in non-framework environments.

There are lot of great react libraries which I would like to use in non-react applications and it would be great to have that same library in some X framework by just building a wrapper over it.

3 comments

This is built on the Lexical framework, which is exactly what you suggest - vanilla JS with optional React bindings. OP's project is an additional React-specific layer on top of Lexical, and since it's concerned with rendering the editor UI it makes sense that it's UI rendering library specific.
You could just render a single component using ReactDOM if you wanted to use React libraries within a non-framework environment. You don't have to go full-SPA with React, you can use it piecemeal.
Building a native JS library for something that I only want in React sounds like it’d bring me no benefit for a lot of extra effort.
Yes - if you're building just for yourself, but if you're building an OSS library your _audience_ is now larger than just React one and you have potential benefit of writing a thin wrapper around it in some new framework (if React stops being _mainstream_). Writing a wrapper around it sounds better than rewriting a whole library.
If someone else has done this, you’d only have to create the react layer. That’s one of the benefits