-
Notifications
You must be signed in to change notification settings - Fork 942
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
Dependency Injection using .defaultProps #16
Comments
topa
changed the title
Dependency Injection using .initialProps
Dependency Injection using .defaultProps
Nov 10, 2016
I have no idea how I missed that issue. It's really weird. Sorry. So, I think the idea is interesting but we kind of having the same problem. It is nice approach for delivering something to a component but I think the main problem is not in how we'll send the dependencies as props but how these dependencies reach the file of the component. What you are showing is I believe DI done via the module system. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've created a gist that shows how DI could be solved for cases using only React features: https://gist.github.com/topa/efd6b170e18bda579aa751c5164f9211.
Do you think this could be also a valid approach?
This won't work with isomorphic apps as you'll have to initialize
.getAppLocale()
while bootstrapping the app either on server (e.g. in express Appsreq.locale
) as on client (usingwindow.navigator
).The text was updated successfully, but these errors were encountered: