简体   繁体   English

Redux React-Native(在 react-redux 中使用 useSelector 与使用 connect 有什么区别?)

[英]Redux React-Native (What's the diffrence using useSelector in react-redux than use connect?)

I think they were same because they extract the content of the store.我认为它们是相同的,因为它们提取了商店的内容。 How could it makes it diffrent怎么会不一样

I think you are asking about the different use case for Hooks vs Redux.我认为您是在询问 Hooks 与 Redux 的不同用例。

Rule of thumb to use Hooks over Redux:在 Redux 上使用 Hooks 的经验法则:

  1. For a single view app that doesn't load or save state对于不加载或保存状态的单视图应用程序
  2. Has no asynchronous I/O or not using the network没有异步 I/O 或不使用网络
  3. Does not share state with non-child components.不与非子组件共享状态。
  4. Does need some ephemeral state (UI state or local state)是否需要一些临时状态(UI 状态或本地状态)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM