初学reactNative,记录查看的资料
(一)简单的框架搭建记录
https://www.jianshu.com/p/66b996ffca54 点击打开链接
(二) webstrom破解资料(目前用的第一种,不知可用不可用)
https://blog.csdn.net/voke_/article/details/76418116
(三)遇到的问题
(1)react-native run-ios运行时出错:unable to find utility "instruments", not a developer tool or in PATH
解决办法:终端输入 sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/ 至于为什么我也不清楚,知道的宝宝可留言啊
(四)引入自定义组件
import ComText from "./componen/comText";
(五)导航栏传参
(六) 生命周期
该段文字转自其他人,在这里只是引起注意
在各个生命周期建议做的事
constructor()方法里初始化state
componentDidMount()方法里跑网/耗时操作
componentWillMount()可在方法里对state进行最后的修改
注意,不要在 constructor 或者 render 里 setState(),這是因为 constructor 已含 this.state={} ,而 render 里 setState 会造成setState -> render -> setState -> render
能做的setState,只要是render前,就放在componentWillMount,render后,就放在 componentDidMount。這两个 function 是 react lifecycle 中,最常使用的两个。当然啦,还有其它的部分,那就交给客官们自行研究和推敲它们的使用时机咯!
查看资料地址 https://blog.csdn.net/ddwhan0123/article/details/78490884