import React from 'react'
import { render } from 'react-dom'
import App from './modules/App'
render(<App/>, document.getElementById ('app'))
The first line means to introduce the entire js from react and name it React
The second line means to introduce the render method from react-dom
Do I understand this correctly? . Why is the path written in the third line? Can I write one or two lines directly?
The third line means to name this unnamed component App and then use it?
The URL of the demo to watch is here and the link description
Pay attention to the package.json in the demo. It introduces many dependencies, including react and reactdom. npm i (or npm install) installs dependencies to node_modules.
If it is ./, it means importing files under relative paths. If you directly import any path without writing it, you will import the installed modules in the node_modules directory.
It is recommended to take a look at the knowledge of webpack and commonJS specifications