LoginSignup
8
4

More than 5 years have passed since last update.

mapStateToPropsのownPropsとは 個人メモ

Last updated at Posted at 2018-06-13

以下のような発言と出会った。

Second argument of mapStateToProps is your component's props. So when you connect(mapStateToProps)

function mapStateToProps (state, ownProps) {
  console.log(ownProps)
  return {
    value: state.somestate.someobject[ownProps.variable]
  }
}

つまり、ownPropsとは現在のpropsを表すらしい。
console.log(ownProps)とすると、現在のpropsが表示された。
素晴らしい。

8
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
4