Skip to content

Commit 376d401

Browse files
authored
Formatted the new code blocks
1 parent 64b06ae commit 376d401

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

docs/using-react-redux/connect-dispatching-actions-with-mapDispatchToProps.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -151,26 +151,23 @@ If your `mapDispatchToProps` function is declared as taking two parameters, it w
151151

152152
This means, instead of re-binding new `props` to action dispatchers upon component re-rendering, you may do so when your component's `props` change.
153153

154-
155154
**Binds on component re-rendering**
155+
156156
```js
157-
render(){
158-
return(
159-
<button onClick={() => this.props.toggleTodo(this.props.todoId)} />
160-
);
157+
render() {
158+
return <button onClick={() => this.props.toggleTodo(this.props.todoId)} />
161159
}
162160

163-
const mapDispatchToProps = (dispatch) => {
164-
toggleTodo: (todoId) => dispatch(toggleTodo(todoId))
161+
const mapDispatchToProps = dispatch => {
162+
toggleTodo: todoId => dispatch(toggleTodo(todoId))
165163
}
166164
```
167165

168166
**Binds on `props` change**
167+
169168
```js
170-
render(){
171-
return(
172-
<button onClick={() => this.props.toggleTodo()} />
173-
);
169+
render() {
170+
return <button onClick={() => this.props.toggleTodo()} />
174171
}
175172

176173
const mapDispatchToProps = (dispatch, ownProps) => {

0 commit comments

Comments
 (0)