Scrivito.CurrentPage

Displays the current page.

Copy
ReactDOM.render(
  <Scrivito.CurrentPage />, 
  document.getElementById('application')
);

Props

<Scrivito.CurrentPage> does not accept any props.

Remarks

To build a very simple serverless single-page application, it is sufficient to mount the <Scrivito.CurrentPage> component into the DOM. Thus, rendering any page and its widgets boils down to a single JavaScript call, surrounded by some HTML boilerplate:

Copy
<html>
  <head>

    <!-- required libraries -->
    <script src="react.js"></script>
    <script src="react-dom.js"></script>
    <script src="scrivito.js"></script>
    <script src="babel.js"></script>

    <!-- my widget and page classes and components -->
    <script src="widgets_and_pages.js"></script>

  </head>
  <body>

    <!-- app container -->
    <div id="application"></div>

    <script type="text/babel">
      // Scrivito bootstrapping code
      ReactDOM.render(
        <Scrivito.CurrentPage />, 
        document.getElementById('application')
      );
    </script>

  </body>
</html>

This template omits the code needed to specify the available pages and widgets (defined in widgets_and_pages.js). But this additional code is as simple or as complex as your app requires.