mcnamee / react-native-starter-kit

:rocket: A React Native boilerplate app to get you up and running very, very quickly :rocket:
MIT License
3.35k stars 863 forks source link

Clarifications needed on the use of 'Layout' #156

Closed amak07 closed 6 years ago

amak07 commented 6 years ago

@mcnamee Can you please explain how you are connecting to Container components from the native side? I see 'Layout' is being used as part of the flux-router configuration but where is this input defined and how does it connect, say, Recipes Component with Recipes Container?

Also, where is the 'Layout' component coming from ? We see that every container is returning Layout with props attached...

Thanks for clarifications. Abel

jbarros35 commented 6 years ago

I'm on the same boat, I did exactly how on recipe thing but didn't worked.

mcnamee commented 6 years ago

Hi @amak07 The project aims to follow the Redux/React concept - presentational vs container components.

A Container will do all the business logic, fetch and data etc and pass props (incl. data) to the Presentational component (which I've just referred to as the Layout).

Each screen that you can visit, is setup by a route (eg. /native/routes). This is where we define which container and which layout a screen uses.

To make the cross-platform magic happen, both web and native share containers - in the aim that the business logic is shared and then we can just layout each platform's look and feel according to the platform (eg. the website will look like this and the app will look like that).

Hope that make sense

jbarros35 commented 6 years ago

After some while reviewing it makes sense. Thanks