December 2019
Intermediate to advanced
598 pages
12h 21m
English
Now it's time to start looking at the React app code and how components are implemented. Remember that the root JavaScript file is index.js in the ClientApp folder. Let's open this file and look closely at the following block of code:
const rootElement = document.getElementById('root');ReactDOM.render(<BrowserRouter basename={baseUrl}> <App /></BrowserRouter>,rootElement);
The first statement selects the div tag we discovered earlier, which has the root ID and stores it in a variable called rootElement.
The next statement extends over multiple lines and calls the render function from the React DOM library. It is this function that injects the React app content into the root div tag. The rootElement ...
Read now
Unlock full access