react组件的属性值若是不是字符串的话,要用大括号括起来。好比<InputText name='sisi' age={6} school='hust' />,若是写做age=6的话,会报错。而且age={6},它的typeof(age)为number,而不是object. 即便是字符串也能够用大括号括起来。一样括起来后仍是string,而不是object.react
react
<InputText name='sisi' age={6} school='hust' />
age=6
age={6}
typeof(age)
number
object
string