Menu
Download Free Trial

Do you have an example of how to import Flexmonster into an existing React component?

Do you have an example of how to import Flexmonster into an existing React component (without typescript)? I’m using React, ES6 and JSX.
Instead of creating a new index.html with <script> tags, I would like to import it into an existing react component.
I’ve installed jQuery with npm and required jQuery and Flexmonster into the desired component like this:

window.jQuery = window.$ = require('jquery');
var FlexmonsterReact = require("../flexmonster/flexmonster.js").default;

And the render function goes like this:

render(){
return(
<div>
<FlexmonsterReact.Pivot
componentFolder="https://s3.amazonaws.com/flexmonster/2.3/"
report="https...."
licenseKey=myKey />
</div>
);
}

Doing it like this gives me the following error: “Uncaught TypeError: Cannot read property ‘Pivot’ of undefined”.

 
Thanks in advance!

Please login or Register to Submit Answer