React-App-Clean-Architecture
React-App-Clean-Architecture copied to clipboard
What the folder di means?
Hi. I checked it out, your project. Looks good, but I don't understand what the folder "di" means? Why you decide to create that folder?
Hello, thank you for your interest in this project.
"di" means dependency injection, so all use cases and data sources need to be inisilized with the correct instance.
For example, in the constructor of src/business/datasource/network/MainNetworkDataSourceImpl, there is an argument of type MainNetworkService, which is an interface; therefore, each time we need to call MainNetworkDataSourceImpl, we must feed it with the correct class that implements MainNetworkService; as a result, I created a di folder to initialize once with the correct instance in src/di/NetworkDataSource.
I hope it is clear. If not, I am here.