[英]How to handle data fetching in multiple components in React Native?
I am new to React Native.我是 React Native 的新手。 Currently, I have multiple components, and each component does several fetches before rendering.
目前,我有多个组件,每个组件在渲染之前都会进行几次提取。 The idea that I have to make a loading screen while the app.js is rendering.
我必须在 app.js 渲染时制作加载屏幕的想法。 But then, other components will still be loading when app.js is shown.
但是,当显示 app.js 时,其他组件仍会加载。 What is the best way to do all the fetches in all components while loading the app.
加载应用程序时在所有组件中进行所有提取的最佳方法是什么? I have found about Higher Order Component and Redux.
我发现了有关高阶组件和 Redux 的信息。 However, I don't know what is the best approach to use.
但是,我不知道什么是最好的使用方法。
I would say that there are 3 main concepts and realizations for today that solve the issue you have.我想说今天有 3 个主要概念和实现可以解决您遇到的问题。
There is no Best or Correct way to handle the global state, just one you chose.没有最佳或正确的方法来处理全局 state,只有您选择的一种。 One concept can be more familiar for you, other super-new.
一个概念对你来说可能更熟悉,另一个是超级新的。 I would recommend you to read the documentation and one you think is easier to work with - is one you need.
我建议您阅读文档,您认为更容易使用的文档是您需要的文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.