reactnative - 16. react native 天生就是异步的。(async)
访问量: 1421
参考:https://stackoverflow.com/questions/32544406/parse-cant-find-localstorage-variable-in-react-native 和 https://stackoverflow.com/questions/36902611/is-there-a-simple-synchronous-storage-option-for-react-native
我们在开发的时候,要做好转变:
1. 原生开发:都是顺序执行的(sync方式),仅仅在小部分地方是异步的(http请求, 加载图片等。)
2. react native开发:天生就是异步的。 例如读取本地数据: AsyncStorage
可以说我是绕了一些弯路来尝试,最后发现异步这个地方是绕不过去的