Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create an embeddable widget using React

I have a small form component built using React that I want to make into an embeddable widget for use on other pages. I believe I heard Babelify can help accomplish this, but I'm honestly drawing a blank on how to get this working. I used Babelify to create a bundle.js of the form component, but sticking that on to a blank HTML page using <script src='bundle.js'></script> didn't do anything. So clearly I am either misunderstanding something or am just...totally lost.

like image 291
demluckycharms Avatar asked Jan 11 '18 00:01

demluckycharms


People also ask

How do I create an embeddable widget?

To set a widget as embeddable, go into the widget settings and check the "Make Embeddable" box. All visitors of you site will be able to see the <embed> link when hovering over the widget. Clicking the <embed> link with generate the iFrame code to embed the widget into a site. Copy the iFrame code.

Can we use iframe in Reactjs?

In React, developers use iframes to create either a sandboxed component or an application that is isolated from its parent component. In an iframe, when a piece of content is embedded from an external source, it is completely controlled by the source instead of the website it is embedded in.


1 Answers

Created an embeddable widget with react by following this tutorial http://krasimirtsonev.com/blog/article/javascript-library-starter-using-webpack-es6

like image 171
mouthzipper Avatar answered Sep 30 '22 11:09

mouthzipper