elfi icon indicating copy to clipboard operation
elfi copied to clipboard

Passing props to mapStateToProps

Open kud opened this issue 7 years ago • 1 comments

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?

kud avatar Apr 11 '18 15:04 kud

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

madx avatar Apr 12 '18 06:04 madx