A boilerplate for building Javascript widgets in react.
- Install dependencies with
yarn
(ornpm install
).
yarn dev
(ornpm run dev
) will run a local website embedding the widgets.yarn build
(ornpm build
) will build a production version of the widget as widget.js in/build
folder.
The widget will create an object called ReactWidget on the window, with 2 functions, create and destroy.
This function will create the widget and show it on the page. options is an object to pass in variables to the widget, in the boilerplate example colour is passed in to change the colour of the box.
Removes the widget
- This boilerplate uses styled components for css styling.