Let's start by editing our application's main JavaScript file. Replace the content of the ~/snapterest/source/app.js
file with the following code snippet:
import React from 'react'; import ReactDOM from 'react-dom'; import Application from './components/Application'; ReactDOM.render( <Application />, document.getElementById('react-application') );
There are only four lines of code in this file, and as you can guess, they provide document.getElementById('react-application')
as a deployment target for the <Application/>
component and render <Application/>
to the DOM. The whole user interface for our web application will be encapsulated in one React component, Application
.
Next, navigate to ~/snapterest/source/components/
and create the Application.js
file inside this directory:
import React, { Component } from 'react'; import Stream from './Stream'; import Collection from './Collection'; class Application extends Component { state...