Code Monkey home page Code Monkey logo

Comments (8)

alejandropaciotti avatar alejandropaciotti commented on May 9, 2024 2

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.

AurelGit avatar AurelGit commented on May 9, 2024 1

Thank you very much for your hard work.
I will analyze your PR and give you a feedback soon.

from react-native-boilerplate.

JeremyDolle avatar JeremyDolle commented on May 9, 2024 1

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.

alejandropaciotti avatar alejandropaciotti commented on May 9, 2024

btw, I've the code ready for a PR.

from react-native-boilerplate.

JeremyDolle avatar JeremyDolle commented on May 9, 2024

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.

alejandropaciotti avatar alejandropaciotti commented on May 9, 2024

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.

JeremyDolle avatar JeremyDolle commented on May 9, 2024

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.

alejandropaciotti avatar alejandropaciotti commented on May 9, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.