React 学习:jsx 、变量定义、语法糖、三元表达式

版权声明:欢迎关注博主公众号:矿洞程序员 https://blog.csdn.net/qq_32423845/article/details/89229156

1 定义变量:const

2 花括号的使用:{}

3 语法糖的体现

4 数组的遍历

import React from 'react'

class Welcome extends React.Component {
    render() {
        // const todoList=['learn React','learn Redux']
        // const isLogin=false
        const test=<h1>hello react</h1>
        console.info(test)
        return (
            <div>
                {
                    /* <h1>hello world</h1>
                 <ul>
                     {
                         todoList.map(itemthis=>
                             <li>{item}</li>
                         )
                     }
                 </ul>*/
                    // isLogin ? <p>你已经登陆</p> : <p>请登录</p>
                }
        </div>
        )
      };
}

export default Welcome;

猜你喜欢

转载自blog.csdn.net/qq_32423845/article/details/89229156