Mevia
Mevia

Reputation: 1564

react app loaded as widget to a container at customer website

I will be building an app that is suppose to be serving as a widget and i wanted to use react to do so, but i just started with react, i created app using "Create React App", i made some components and i have working prototype in development environment but ...

The guys asked that they will give me an id of a container where widget should be placed and they are asking for css and js links and they expect widget to be build in there.

I started inspecting my environment and i kind of dont know where to start, in sources i see that there is gazilion packages connected and some 40k lines bundle.js file.

Is it possible that the customer on his website just puts:

<link rel="stylesheet" type="text/css" href="__LINK_TO_SERVER__app.css">
<div id="app-widget"><!-- APP WILL BE HERE --></div>
<script src="__LINK_TO_SERVER__/app.js"></script>

and this app will be working?

If so, what are the steps to make it to work?

Upvotes: 0

Views: 60

Answers (1)

Alex Antonov
Alex Antonov

Reputation: 15216

  1. It's completely possible.
  2. You may include <link rel="stylesheet"> insertion into your js bundle
  3. Don't forget about async option: <script async src="__LINK_TO_SERVER__/app.js"></script>

Upvotes: 1

Related Questions