April 2020
Intermediate to advanced
716 pages
18h 55m
English
The client/main.js file in the client folder will be the entry point to render the complete React app, as already indicated in the client-side Webpack configuration object. In client/main.js, we import the root or top-level React component that will contain the whole frontend and render it to the div element with the 'root' ID specified in the HTML document in template.js.
mern-skeleton/client/main.js:
import React from 'react'import { render } from 'react-dom'import App from './App'render(<App/>, document.getElementById('root'))
Here, the top-level root React component is the App component and it is being rendered in the HTML. The App component is defined in client/App.js, as discussed in the next subsection.
Read now
Unlock full access