Basic ReactJS Components routing Recently I've started learning ReactJS and I do not look forward to making one Page website so I learned about react-router and this is my way of doing to it.

App.js

import React, { Component } from "react";
import "babel-polyfill";
import Navbar from "./Components/MenuNavbar";
import Footer from "./Components/Bottom";
import Home from "./Components/Home";
import About from "./Components/About";
import Contact from "./Components/Contact";
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
import Products from "./Components/Products";
import { CircleArrow as ScrollUpButton } from "react-scroll-up-button";
// import Topbar from "./Components/Topbar";

class App extends Component {
  render() {
    return (
      &lt;div className="App"&gt;
        &lt;Router&gt;
          &lt;React.Fragment&gt;
            &lt;Navbar /&gt;
            &lt;Switch&gt;
              &lt;Route exact path="/" component={Home} /&gt;
              &lt;Route exact path="/products" component={Products} /&gt;
              &lt;Route exact path="/about" component={About} /&gt;
              &lt;Route exact path="/contact" component={Contact} /&gt;
            &lt;/Switch&gt;
            &lt;ScrollUpButton /&gt;
            &lt;Footer /&gt;
          &lt;/React.Fragment&gt;
        &lt;/Router&gt;
      &lt;/div&gt;
    );
  }
}

export default App;


In my other Components, I wrap parent in a div as learned in some tutorials, like this:

render() {
    return (
      &lt;div id="products"&gt;
        &lt;ProductsHero /&gt;
        &lt;ProductsCashew /&gt;
        &lt;ProductsAlmonds /&gt;
      &lt;/div&gt;
    );
  }


Is this the best practice? If not how can I improve? Shall I wrap every child in React.Fragment instead of div? If so why?
Whether to use React.Fragment or not depends on how you want the resulting DOM structured. Using React.Fragment avoids introducing additional elements in the DOM when they are not needed.

Fragments were introduced because only one React element can be returned from the render function, but it is pretty common and natural to need to return more than one element. Before Fragments, we had to wrap these elements in a div or other tag that really served no other purpose than to please React. This worked most of the time, but there were cases where it was not sufficient, such as when a component needed to return two tr elements. Wrapping tr's in a div and trying to place that in a tbody doesn't work. With Fragments, multiple elements can be returned and React does not have to render anything for the Fragment itself, only the children of the Fragment.

That being said, there are some situations where wrapping elements in a div or other tag makes sense. One that comes up frequently for me is when I have a component just like your products example, but I want to apply a margin, padding, border, or other style to the wrapper around the actual children. In that case, React.Fragment can't help me and I need a div or section.

A general rule-of-thumb, if you have a div or section that is doing absolutely nothing but letting you return multiple elements, you should switch it out with React.Fragment. If you are using that wrapper div in any way, keep it.

If you haven't yet, I would suggest reading the official Fragments guide. It demonstrates the table situation as an example for why Fragments were introduced.