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!

1 answer

Public
Dmytro Zvazhii Flexmonster April 24, 2017

Hello Jaakko,
Thank you for your question. Could you please send us your project example? It will be very helpful to know how are you going to insert the Flexmonster component. That will allow us preparing the right sample for you.
Waiting for your reply.
Best regards,
Dmytro.

Please login or Register to Submit Answer