react native arrow functions and if statements

独自空忆成欢 提交于 2019-12-01 13:48:06

myFunction() is a class level function. Binding anything to this is referring a class itself, therefore you need to bind it to access this property, otherwise you won't be able to access the class level props.

Although there are many ways to bind this as explained here, but the simplest one would be to use the shorthand arrow syntax as

myFunction = () =>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!