我正在尝试传递 this.props.item
,以便我可以用它执行一些操作,但我无法这样做,它给了我错误:无效箭头函数参数的左侧
。它通过一个数组运行,因此它实际上具有值
<TouchableOpacity onPress={(this.props.item) => {
//Do something with value here
}}
>
我也尝试过这种方式,不幸的是
<TouchableOpacity onPress={this.props.item => {
//Do something with value here
}}
>
请问正确的写法是什么?
最佳答案
也许您正在寻找类似的东西
<TouchableOpacity onPress={() => {
console.log(this.props.item)
}}
>
关于javascript - 传承值(value),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47781746/