Get Free Trial
Get Free Trial

How do I load local JSON

Answered
zorrocaesar asked on March 17, 2019

When I display the Flexmonster component in my React/Redux app, I would like to load a JSON that is a prop of my component (set by mapStatetoProps). How can I do that?
Of course, I would like to reload the flexmonster data once the state is changed.

1 answer

Public
Vera Didenko Flexmonster March 18, 2019

Hello, 

Thank you for posting your question here.

Flexmonster has a property for loading a JSON report.  The report property can be inline report JSON, URL to report JSON or URL to report XML.

Please consider the following example:

class App extends Component {
  render() {
    return (
      <div className="App">
        <FlexmonsterReact.Pivot toolbar={true} 
        componentFolder="https://cdn.flexmonster.com/" width="100%" 
        report="https://cdn.flexmonster.com/reports/report.json"/>
      </div>
    );
  }
}

You can find more information in our integration with React guide. 

 
You can pass the object returned by your mapStateToProps function into the report property. Please note that the object structure should meet specific requirements.

In Flexmonster JSON data can be updated using the updateData API call.
 
Please let us know if this works for you and if you have further questions.

Best Regards,
Vera

Please login or Register to Submit Answer