Hot component reloading in action

Earlier in this chapter, you learned how to start the react-scripts development server. This development server has hot module reloading configured and ready to use. All you have to do is start writing component code.

Let's start by implementing the following heading component:

import React from 'react'; 
 
const Heading = ({ children }) => ( 
  <h1>{children}</h1> 
); 
 
export default Heading; 

This component will render any child text as an <h1> tag. Easy enough? Now, let's change the App component to use Heading:

import React, { Component } from 'react'; import './App.css'; import Heading from './Heading'; class App extends Component { render() { return ( <div className="App"> <Heading> My App </Heading> </div> ...

Get React 16 Tooling now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.