You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 Apps req.locale ) as on client (using window.navigator).
The text was updated successfully, but these errors were encountered:
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.
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: