Skip to content

Feat/react context for di #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Joao-vi
Copy link

@Joao-vi Joao-vi commented Feb 10, 2023

Using React Context to Dependencie Injection

Inside the Services folder we've got all set up for react context, provider and hook, there will be our entry point to inject new dependencies or replace.

An interesting point: If I needed to change a dependency to a specific use case? How would be? Since we're injecting the dependency to use for all useCase throughout our code base.

Anserw: Whenever you retrieve a context, the React's algoritm will reach to the CLOSEST provider available on the tree, that's it!

Need a specific dependencies for a use case? Just create another provider replacing the services for that specific use case!

P.S: this approach will replace the Implementations classes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant