Ask HN: Tips for building a JavaScript lib to integrate with React?
1 points| smcgraw | 8 years ago
However...
I'm also wanting to write it such that a modern UI library / framework (e.g. React) can extend this library as a wrapper, and in essence, 'recreate' the same component library API out of React components instead of raw JS ones. So there's this vanilla JS library doing most of the work, but a React wrapper on top as well to help those on a React stack.
I've read the React docs[1] on how to integrate React with a plugin that you can't control - which were very helpful- however, I'm looking for best practices on how to build a plugin (obviously that I can control) that plays as nicely as possible with React.
I realize this is pretty high-level stuff, but any resources, tips from experience, or examples of JS libraries like this (that is, created with framework integration in mind from the start) that you've seen or worked on / with would really help!
[1] https://reactjs.org/docs/integrating-with-other-libraries.html#integrating-with-dom-manipulation-plugins
kgenus|8 years ago
Could you be a little more descriptive? If you're talking about creating a more visually appealing UI/UX experience, are you talking about creating a framework that more effectively handles UI component state?
Maybe I'm missing something and am way off base.
smcgraw|8 years ago
So I'm looking to create something very similar to Material Design, a vanilla JS/CSS library (https://material.io/components/web/), which is extended and used in Material UI, a React component library (http://www.material-ui.com/).
I guess I'm essentially asking: if I were to build Material Design, knowing full well I'd use it later to create something like Material UI, are there any recommendations out there for building the vanilla lib to make sure I don't shoot myself in the foot integrating that vanilla lib into the React lib?