ActiveReports 16 .NET Edition
ActiveReports 16 User Guide / Preview Reports / JavaScript / Integration to React Application
In This Topic
    Integration to React Application
    In This Topic

    This page explains how you can embed the JSViewer component in your React application (ASP.NET Core). To run the React Application Server, you will require the node.js JavaScript runtime.

    1. Create an ASP.NET Core React project and configure ActiveReports in ASP.NET Core Middleware as illustrated in JSViewer ASP.NET Core Middleware topic.
      Now configure the client application for React application as illustrated in the next steps.

    2. Expand the ClientApp folder and open 'package.json'.

    3. Add the following package for JSViewer under 'dependencies' and save package.json:
      "@grapecity/ar-viewer": "latest"

    4. In the command prompt, open the ClientApp folder's location and run npm install command to install the JSViewer packages.

    5. Navigate to ClientApp\src  folder.

    6. Open 'App.js' and replace the content with the following code to initialize the JSViewer:

      Copy Code
      import React, { Component } from 'react';
      import './custom.css'; 
      export default class app extends Component {
          GrapeCity: any;
          constructor(props) {
          componentDidMount() {
              this.viewer = window.GrapeCity.ActiveReports.JSViewer.create({
                  element: '#viewer-host',
                  reportID: 'DemoReport.rdlx'
          componentDidUpdate() {
          render() {
              return (
                      <div id="viewer-host" />
    7. Add the following import statements in 'index.js' file.
      import "@grapecity/ar-viewer/dist/jsViewer.min.js";
      import "@grapecity/ar-viewer/dist/jsViewer.min.css";

    8. Add the following css in 'custom.css' file to set the viewer's host element's size to 100%.

      Copy Code
      #viewer-host {
          width: 100%;
          height: 100vh;
    9. Build the application and then press F5 to run it.