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

Posted just coding

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了React Native JSX value should be expression or a quoted JSX text.相关的知识,希望对你有一定的参考价值。

问题描述: 

      我在使用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>

 

以上是关于React Native JSX value should be expression or a quoted JSX text.的主要内容,如果未能解决你的问题,请参考以下文章