Skip to Main Content
React Design Patterns and Best Practices - Second Edition
book

React Design Patterns and Best Practices - Second Edition

by Carlos Santana Roldán
March 2019
Intermediate to advanced content levelIntermediate to advanced
350 pages
7h 28m
English
Packt Publishing
Content preview from React Design Patterns and Best Practices - Second Edition

Creating our sections

Let's create some sections to test some basic routes. We need to create four stateless components (About, Contact, Home, and Error404) and name them as index.jsx in their directories.

You can add the following to the src/components/Home.jsx component:

  import React from 'react';  const Home = () => (     <div className="Home">      <h1>Home</h1>    </div>  );  export default Home;

The src/components/About.jsx component can be created with the following:

  import React from 'react';  const About = () => (     <div className="About">      <h1>About</h1>    </div>  );  export default About;

The following creates the src/components/Contact.jsx component:

  import React from 'react';  const Contact = () => (     <div className="Contact">      <h1>Contact</h1> ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

React 17 Design Patterns and Best Practices - Third Edition

React 17 Design Patterns and Best Practices - Third Edition

Carlos Santana Roldán

Publisher Resources

ISBN: 9781789530179Supplemental Content