Back

reactnative - 16. react native 天生就是异步的。(async)

发布时间: 2018-12-28 01:35:00

参考:https://stackoverflow.com/questions/32544406/parse-cant-find-localstorage-variable-in-react-nativehttps://stackoverflow.com/questions/36902611/is-there-a-simple-synchronous-storage-option-for-react-native

我们在开发的时候,要做好转变:

1. 原生开发:都是顺序执行的(sync方式),仅仅在小部分地方是异步的(http请求, 加载图片等。) 

2. react native开发:天生就是异步的。 例如读取本地数据: AsyncStorage 

可以说我是绕了一些弯路来尝试,最后发现异步这个地方是绕不过去的

Back