1 | initial version |
Assuming that you have already created a React application using some sort of tool like Create React App, here are the steps to display your application on the index.js file:
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
The import statement for your React component should reflect the file path to your component file.
ReactDOM.render(<App />, document.getElementById('root'));
The first argument to ReactDOM.render() is your main React component, and the second argument is the DOM element where you want to render the component. In this case, we're rendering the App component inside an element with an ID of "root".
If everything goes well, your React application should now be displayed on the index.html file.