madx / elfi

An elegant state container for your JavaScript applications
https://madx.github.com/elfi
MIT License
17 stars 2 forks source link

Passing props to mapStateToProps #7

Open kud opened 6 years ago

kud commented 6 years ago

It could be great to access to props given to Component via connect().

like:

export default injectIntl(
  withRouter(
    connect(TextPage, (state, store, props) => ({
      storeBill: state.bills.bydId[props.match.params.id],
    })),
  ),
)

for that, in elfi/react.js -> connect(), we should change from:

const propsFromStore = mapStateToProps(store.getState(), store)

to:

const propsFromStore = mapStateToProps(store.getState(), store, this.props)

what do you think?

madx commented 6 years ago

The idea is interesting yes, lemme check how it impacts the code base and/or if we should do something more :)