Need help on some concepts about ReactNative and Redux and Navigator

前端 未结 1 337
Happy的楠姐
Happy的楠姐 2021-01-19 16:12

After several tests in this scenario, I have some questions that I can not answer my self, so I ask for help to clarify my concepts.

  1. Provider vs props
1条回答
  •  有刺的猬
    2021-01-19 17:05

    1. The first solution should be used, as the provider should be the outermost component (so that everything underneath may connect properly).
    2. You could either run a callback on componentDidReceiveProps or (what I would prefer) simply connect the component, which needs access to a store. This is exactly what redux is for. The only reason not to do this is if you would like to reuse a component with another stores content (truly representational component)
    3. This strongly depends on the application and the depth of the components but in general, this is completely okay. You may also pass the information as props, but as your application grows bigger you may have to pass a lot of props, which may obfuscate the real intend of you components

    0 讨论(0)
提交回复
热议问题