Skip to content

Instantly share code, notes, and snippets.

import { render } from "react";
import MyWidget from "./components/mywidget.jsx";
window.MyWidgetRenderer = function(node, props) {
render(<MyWidget {...props} />, node);
};
@BjoernRuberg
BjoernRuberg / ComponentLoader.jsx
Last active December 2, 2017 20:36
Code example for a component that loads another react component from external servers
import {Component} from "react";
var CrossCustomEvent = require('customevent');
var scriptLoader = require("load-script");
module.exports = function(identifier) {
/* Customers pass some kind of identifier to this function.
* It might be a user name or an access key.
* Something that identifies the location of the script code of this customer
*/
class Wrapper extends Component {