html5 - I encountered a problem while watching the demo of react router
阿神
阿神 2017-05-31 10:40:18
0
1
670

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

阿神
阿神

闭关修行中......

reply all(1)
Peter_Zhu

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!