krasimir / react-in-patterns

A free book that talks about design patterns/techniques used while developing with React.
https://www.gitbook.com/book/krasimir/react-in-patterns/
MIT License
13.42k stars 969 forks source link

DI examples powered by InversifyJS? #1

Closed remojansen closed 8 years ago

remojansen commented 8 years ago

Hi,

I fund this repo on twitter because some users mentioned InversifyJS I keep an eye on mentions to InversifyJS because I'm it main author.

Would you be interested in adding examples to the dependency-injection page about DI in react powered by InversifyJS?

You can find some real use cases here and here.

If you think you would like it I can prepare a PR.

Thanks!

krasimir commented 8 years ago

Hey,

definitely interested. If you have time submit a PR. If not I'll prepare one next few days.

remojansen commented 8 years ago

Cool, I don't know If I will be able to send it this week. Just let me know if you do it this week so we don't duplicate work... I will let you know if I'm working on it :)

krasimir commented 8 years ago

Sounds good. Write here before you start.

remojansen commented 8 years ago

I just sent a PR #10

krasimir commented 8 years ago

Hello @remojansen,

sorry for the delay in my reply but I was reading your PR several times and I realized that it's kinda confusing for the reader and a little bit against the idea of this repository. Which is to teach patterns not tools. InversifyJS is an awesome library but it's a tool that solves the problem by bringing level of abstraction. I feel that the proper approach will be to explain what's used under the hood and even desribe how to implement your own IoC container. It's nice that we show how easy InversifyJS injects dependencies but we are missing the pattern resolution. Instead we are giving a knowledge about a library interface.

So, I brought your writing in the Dependency injection document as part of "Injecting with the help of a build process". Jumping from React's context to that alternative is a little bit misleading because we introduce another library (with its own API) and TypeScript syntax.

Thanks for quoting the context usage considerations. I placed them on the page as part of the first section.

remojansen commented 8 years ago

No problem thanks for adding it to the docs :)

krasimir commented 8 years ago

👍