I am working on a fairly complex web app using React.js, and I would like to allow the app's users to use one of the components as an API widget on their sites as well with a script tag (think Google Maps API, Analytics, etc.)
I'm new to React, but I think React takes all of the components, etc. in the app, and bundles them into a single JS file.
Is it possible to bundle only one component into a JS file, then let users place that file in their site, and use it as a widget?
I've tried transpiling the component I want users to use as a widget with reactify, but I can't seem to get it to work.
Any thoughts?
Absolutely, however they will still need to include React as a dependency, or you would have to in your widget.
To use React you don't need to use transpilation, i.e. you don't need reactify. Building a widget for React is like building a widget for jQuery.
The only reason you would need to transpile your code would be to use JSX and ES6.