React多组件嵌套
React多组件嵌套
webpack-dev-server环境运行起来,这里主要是明白了React如何做嵌套
src/js/components下创建header.js书写代码✍️
import React from 'react';
import ReactDOM from 'react-dom';
export default class CompomentHeader extends React.Component{
render(){
return(
header>
h1>这里是表头
/header>
)
}
}
src/js/components下创建footer.js书写代码✍️
import React from 'react';
export default class CompomentFooter extends React.Component{
render(){
return(
footer>
h1>这里是尾部
/footer>
);
}
}