Skip to content

Commit

Permalink
Fix: Fix typo in connect.md (#1517)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimYunSup committed Feb 6, 2020
1 parent 77a2044 commit 607f1ba
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion website/versioned_docs/version-7.1/api/connect.md
Expand Up @@ -122,7 +122,7 @@ The second parameter is normally referred to as `ownProps` by convention.
```js
// binds on component re-rendering
;<button onClick={() => this.props.toggleTodo(this.props.todoId)} />
<button onClick={() => this.props.toggleTodo(this.props.todoId)} />

// binds on `props` change
const mapDispatchToProps = (dispatch, ownProps) => {
Expand Down

1 comment on commit 607f1ba

@kayuapi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be
<button onClick={this.props.toggleTodo} todoId={someIdHere} />
because the next few lines:

const mapDispatchToProps = (dispatch, ownProps) => {
  toggleTodo: () => dispatch(toggleTodo(ownProps.todoId))
}

maps the field (which is a function):
() => dispatch(toggleTodo(ownProps.todoId))
to a prop named toggleTodo?

Please sign in to comment.