React(jsx)

JSX组成

tagname
attribute
children

比如

let jsx=
Hello worldbye
tagname:'div'
attribute:{name:"hello"}
children:"Hello World",{
tagname:'span'
attribute:{age:13}
children:"bye"
}

jsx特性

  • jsx 中不能一次性返回零散的多个节点,如果有多个请包涵在一个父节点中。
  • 关于注释
return (
 // jsx 外面的注释 
{/* jsx 里面的注释 */}

hello world

)
  • jsx中使用判断一般会用到三元表达式
 

hello world

你可能感兴趣的:(React(jsx))