Need help with some ReactNative and Redux and Navigator concepts

After several tests in this scenario, I have some questions that I cannot answer myself, so I ask for help to clarify my correct wrong concepts.

Thanks at avance.

1.- Provider against props in the navigator

What is the difference and what is the best approach to setting up Navigator and moving to the repository for different ones. React Native Scenes

export default class App extends Component {
  render () {
    return (
      <Provider store={store}>                        //<-- here
        <Navigator style={{flex: 1}}
        initialRoute={{ component: MainContainer }} //<-- here 

          renderScene={ (route, navigator) => {
            const Component = route.component;
            return (
              <View style={{flex: 1, marginTop:40}}>
                <Component navigator={navigator} route={route} {...route.passProps} />
              </View>
  ...

MainContainer is associated with a component in the rect-redux function connectto pass objects and attribute bindings.

Is this the best access to context or to details?

vs

const store = createStoreWithMiddleware(reducer, initialState); //<-- here
export default class App extends Component {
render () {
  return (
    <Navigator style={{flex: 1}}
      initialRoute={{ component: MainComponent }}

      renderScene={ (route, navigator) => {
      const Component = route.component;
      return (
        <View style={{flex: 1, marginTop:40}}>
          <Component 
             navigator={navigator} 
             route={route} 
             {...route.passProps} 
             store={store}                      //<-- here
               />
       </View>
    ...

2.- Scene ( -),

state ( Redux) actions passProps newScene Navigator, newScene , , .. .

Redux, , ?

- ?

3.- vs connect Scene

, Top to Down, redux state ( component state) 'smart' container 'connect' react-redux props.

.

P.D. , , ReactNative, .

+4
1
  • , ( ).
  • componentDidReceiveProps, ( ) , . , . , , - ( ).
  • , . , , , , , , .
+2

Source: https://habr.com/ru/post/1629765/


All Articles