kadirahq / react-simple-di

Simple Dependancy Injection Solution for React
MIT License
56 stars 24 forks source link

default mapper with functions #1

Closed achtan closed 8 years ago

achtan commented 8 years ago

Why default mapper looks like this:

const defaultMapper = (context, actions) => ({
  context: () => context,
  actions: () => actions
});

"with functions" and not just like this:

const defaultMapper = (context, actions) => ({
  context: context,
  actions: actions
});

?

arunoda commented 8 years ago

Somehow, I don't like to pass a big object over React props. It's feels nice for me to pass a function instead.

lsunsi commented 8 years ago

I had the same doubt haha

macrozone commented 8 years ago

I thought it was to prevent accidental using of context directly in the wrapped component ;-)