问题描述: 

      我在使用props时候,

我的写法是这样的 

...

<View>

  <Person name='john' age=32 gender=true></Person>

</View>

...

 

class Person Extension Component{

  render(){

<View>

  <Text>my name is {this.name}</Text>

  <Text> my age is {this .age}</Text>

<Text> my gender is{this.gender}</Text>

</View>

  }

}

报错React Native JSX value should be expression or a quoted JSX text.

按报错的提示说是JSX的值只支持表达式或者是用引号引起来JSX文本。

解决办法:将Person 定义的那行改为表达式的形式。但是bool值不能够在页面上显示出来

  <Person name='john' age={32} gender={true}></Person>

 

转载于:https://www.cnblogs.com/codetime/p/6237098.html

Logo

开源鸿蒙跨平台开发社区汇聚开发者与厂商,共建“一次开发,多端部署”的开源生态,致力于降低跨端开发门槛,推动万物智联创新。

更多推荐