My Component in react :
Code: Select all
import React from 'react';
class Viewer extends React.Component {
    render() {
        return <div id="viewerContent"></div>;
    }
       componentWillMount() {
        var report = new window.Stimulsoft.Report.StiReport();
        report.loadFile("reports/BaseProjRPT.mrt");
        report.dictionary.databases.clear();
        let connectionString = "Data Source=DESKTOP-J9;Initial Catalog=MasterDb;Integrated Security=True;User ID=amir;Password=1234";    
        let stiConnection = new window.Stimulsoft.Report.Dictionary.StiSqlDatabase("MSSQL1", "MSSQL1", connectionString);
           
         report.dictionary.databases.add(stiConnection);
        var options = new window.Stimulsoft.Viewer.StiViewerOptions();
        this.viewer = new window.Stimulsoft.Viewer.StiViewer(options, "StiViewer", false);
        this.viewer.report = report;
    }
    componentDidMount() {
        this.viewer.renderHtml("viewerContent");
    }
}
export default Viewer;