标签:boot min one meta 图片 ext set AC 入门
react 入门
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script src="https://cdn.bootcss.com/react/15.4.2/react.min.js"></script> <script src="https://cdn.bootcss.com/react/15.4.2/react-dom.min.js"></script> <script src="https://cdn.bootcss.com/babel-standalone/6.22.1/babel.min.js"></script> </head> <body> <div id="root"></div> <script type="text/babel"> // const element=<h1>dfdf</h1> const element=( <div> <p>title</p> <p>content</p> </div> ) function Welcome(props){ // return <h1>hello,{props.name}</h1> return ( <div> <h1>hello,{props.name}</h1> <h1>hello,{props.name}</h1> </div> ) } const Welcome2=(props)=>{ return <h1>hello,{props.name}</h1> } class Wel extends React.Component{ // 都大写 render(){ // return <h1>hi,{this.props.name}</h1> return ( <div> <h1>hi,{this.props.name}</h1> <h1>fine,thank you</h1> </div> ) } } ReactDOM.render( // <h1>Hello, !</h1>, // 1 // element, // 2 // <Welcome name={‘hehe‘}/>, // 函数式组件 3 // <Welcome2 name={‘xiaoming2‘}/>, <Wel name={‘how are you‘}/>, // 类组件 4 document.getElementById(‘root‘) ); </script> </body> </html>
标签:boot min one meta 图片 ext set AC 入门
原文地址:https://www.cnblogs.com/gyz418/p/8989361.html