Comments (8)
I think that the "sagas" and the "store" shouldn't be used outside the containers folder, if any container needed to use the functionality contained in a saga should dispatch an action. And if part of the store is needed it should be accessed using a selector.
I think that this separation would improve the scalability and isolation of each container, as well as the testibility (which I am preparing in another PR).
In summary, the containers communicate with the sagas through actions and data as parameters. And just that. They do not access the functions of the sagas directly.
And a container can be connected to any part of the store regardless of where it is located. But given a large application, for my point of view, I prefer to have separate parts of the store on each container in order to have better organization, I do not think it improves anything of the code. It is simply organization.
Thank you for taking the time to review my proposal!.
from react-native-boilerplate.
Thank you very much for your hard work.
I will analyze your PR and give you a feedback soon.
from react-native-boilerplate.
Hi @alejandropaciotti ! After analyzing your issue and your MR, we agree with you on the fact that we need to add a Screen
folder in order to separate containers and presentational components. But for the refactoring of Saga
and Store
folders, we do not agree, we want it outside of Container
folder because multiple containers can call only one saga, so why putting it in a specific container?
What’s your opinion about that? 😃
from react-native-boilerplate.
btw, I've the code ready for a PR.
from react-native-boilerplate.
In summary, the containers communicate with the sagas through actions and data as parameters. And just that. They do not access the functions of the sagas directly.
100% agree and that what we do
I think that the "sagas" and the "store" shouldn't be used outside the containers folder, if any container needed to use the functionality contained in a saga should dispatch an action. And if part of the store is needed it should be accessed using a selector.
What if a container calls an action of another container? You’ll need to duplicate your action, right? So, if you have 5 screens which have to display the temperature (for example), you’ll do 5 actions (one for each screen) which call the same saga?
from react-native-boilerplate.
Yes, this is the price of having everything modularized.
It is the price of a container being contained in a folder.
But, in the hypothetical case that we have 5 screens that need to call an action, I think those containers should be contained in a parent container. And pass the function from parent to child, or maybe we should think a HOC to share that functionality.
from react-native-boilerplate.
We’ve thought about that and for a first version, we want to keep saga away from containers. But we’re really happy about your PR and we want to keep the idea of Screen
folder. Thank you for your really interesting contribution ! Hope it will continue 😉
from react-native-boilerplate.
Of course I'll continue collaborating! And I understand your point of view, my change has pro, but also has cons.
We could close this issue and keep the interesting conversation that opened up, which certainly contributed more to me than to the repo.
from react-native-boilerplate.
Related Issues (20)
- V4 HOT 4
- [NEW FEATURE REQUEST/IDEA]: Support for npm or specify yarn as prerequisite HOT 3
- SSL pinning HOT 2
- [Help]: Material Top Tabs Navigator Doesn't Work HOT 3
- [NEW FEATURE REQUEST/IDEA]: How To handle deep link in this structure HOT 1
- [BUG]: Crash when debug android app HOT 5
- [BUG]: cannot run android HOT 4
- [BUG]: Got Type Errror at NativeWebSocketModule.connect when: Show Element Inspector => Choose Network tab HOT 2
- [BUG]: Windows init projet HOT 3
- [NEW FEATURE REQUEST/IDEA]: Update version react native 0.73
- Add the Beta build page again HOT 1
- [BUG]: Failed run project HOT 5
- [NEW FEATURE REQUEST/IDEA][v4.0.0]: How about if there is an option for enable redux when create new project HOT 1
- [BUG]: Error when create new project HOT 4
- version selection HOT 1
- Application is not running in android(adb). HOT 7
- [BUG]: not able to open this url "https://thecodingmachine.github.io/react-native-boilerplate/docs/BetaBuild/" HOT 3
- Adding a Q&A section to the documentation HOT 1
- [BUG]: `npx tsc` command is failing
- [NEW FEATURE REQUEST/IDEA]:
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-boilerplate.