diff --git a/docs/api/batch.md b/docs/api/batch.md index 82dbffb88..dcde159a4 100644 --- a/docs/api/batch.md +++ b/docs/api/batch.md @@ -8,7 +8,7 @@ hide_title: true # `batch()` ```js -batch(fn: Function) +batch((fn: Function)) ``` React's `unstable_batchedUpdates()` API allows any React updates in an event loop tick to be batched together into a single render pass. React already uses this internally for its own event handler callbacks. This API is actually part of the renderer packages like ReactDOM and React Native, not the React core itself. diff --git a/docs/api/connect-advanced.md b/docs/api/connect-advanced.md index ff65f1d25..13ba120b8 100644 --- a/docs/api/connect-advanced.md +++ b/docs/api/connect-advanced.md @@ -72,7 +72,7 @@ function selectorFactory(dispatch) { let result = {} const actions = bindActionCreators(actionCreators, dispatch) - const addTodo = text => actions.addTodo(ownProps.userId, text) + const addTodo = (text) => actions.addTodo(ownProps.userId, text) return (nextState, nextOwnProps) => { const todos = nextState.todos[nextOwnProps.userId] diff --git a/docs/api/connect.md b/docs/api/connect.md index 3f50d6f69..985e75f53 100644 --- a/docs/api/connect.md +++ b/docs/api/connect.md @@ -48,7 +48,7 @@ A `mapStateToProps` function takes a maximum of two parameters. The number of de If your `mapStateToProps` function is declared as taking one parameter, it will be called whenever the store state changes, and given the store state as the only parameter. ```js -const mapStateToProps = state => ({ todos: state.todos }) +const mapStateToProps = (state) => ({ todos: state.todos }) ``` ##### `ownProps` @@ -59,7 +59,7 @@ The second parameter is normally referred to as `ownProps` by convention. ```js const mapStateToProps = (state, ownProps) => ({ - todo: state.todos[ownProps.id] + todo: state.todos[ownProps.id], }) ``` @@ -83,12 +83,7 @@ Your component will receive `dispatch` by default, i.e., when you do not supply // do not pass `mapDispatchToProps` connect()(MyComponent) connect(mapState)(MyComponent) -connect( - mapState, - null, - mergeProps, - options -)(MyComponent) +connect(mapState, null, mergeProps, options)(MyComponent) ``` If you define a `mapDispatchToProps` as a function, it will be called with a maximum of two parameters. @@ -103,12 +98,12 @@ If you define a `mapDispatchToProps` as a function, it will be called with a max If your `mapDispatchToProps` is declared as a function taking one parameter, it will be given the `dispatch` of your `store`. ```js -const mapDispatchToProps = dispatch => { +const mapDispatchToProps = (dispatch) => { return { // dispatching plain actions increment: () => dispatch({ type: 'INCREMENT' }), decrement: () => dispatch({ type: 'DECREMENT' }), - reset: () => dispatch({ type: 'RESET' }) + reset: () => dispatch({ type: 'RESET' }), } } ``` @@ -121,11 +116,11 @@ The second parameter is normally referred to as `ownProps` by convention. ```js // binds on component re-rendering -