1. To deal with what module cannot be found in react, the best way is to delete node_modules and re-npm install it! The error that the module cannot be found will be resolved.
2.es6 basic syntax
a. A very important point, block-level scope, generally a pair of braces as a block, out of this, the variable is invalid! let
b.const generally defines constants, and constants are not easily changed!
c. Template string, backticks
name ='my name'
course='react development'
console.log(`hello${name}zhanglu${course}`)
d. const hello1 =(parameter)=>{console.log(`hello ${parameter}`)} The biggest function of the arrow function should be the pointing problem of this
e. Expander
function hello(name1,name2){
console.log(name1,name2)
}
let arr =['imooc','woniu123'];
hello(...arr)
d. const obj={name:'imock',course:'react development app'}
console.log(Object.keys(obj))
console.log(Object.values(obj))
console.log(Object.entries(obj))
I want to start the writing process of the project~~~
Create a new folder component under src where the common components are placed
page This is the folder of the page layer
3. Regarding the problem of simplifying the path, we can add these 2 paragraphs in
function resolve(dir) {
return path.join(__dirname, '..', dir)
}
'@': resolve('src')
The file path on the page can be
import Resigter from '@/page/resigter/index.jsx'
The kind before ../ is directly @