diff --git a/docs/recipes/ReducingBoilerplate.md b/docs/recipes/ReducingBoilerplate.md
index c6e6a61e9c..4c8a326057 100644
--- a/docs/recipes/ReducingBoilerplate.md
+++ b/docs/recipes/ReducingBoilerplate.md
@@ -133,7 +133,7 @@ You can always write a function that generates an action creator:
```js
function makeActionCreator(type, ...argNames) {
return function (...args) {
- let action = { type }
+ const action = { type }
argNames.forEach((arg, index) => {
action[argNames[index]] = args[index]
})
@@ -198,7 +198,7 @@ import {
class Posts extends Component {
loadData(userId) {
// Injected into props by React Redux `connect()` call:
- let { dispatch, posts } = this.props
+ const { dispatch, posts } = this.props
if (posts[userId]) {
// There is cached data! Don't do anything.
@@ -231,7 +231,7 @@ class Posts extends Component {
return
Loading...
}
- let posts = this.props.posts.map(post =>
+ const posts = this.props.posts.map(post =>
)
@@ -262,7 +262,7 @@ Consider the code above rewritten with [redux-thunk](https://github.com/gaearon/
export function loadPosts(userId) {
// Interpreted by the thunk middleware:
return function (dispatch, getState) {
- let { posts } = getState()
+ const { posts } = getState()
if (posts[userId]) {
// There is cached data! Don't do anything.
return
@@ -315,7 +315,7 @@ class Posts extends Component {
return Loading...
}
- let posts = this.props.posts.map(post =>
+ const posts = this.props.posts.map(post =>
)
@@ -461,7 +461,7 @@ Redux reduces the boilerplate of Flux stores considerably by describing the upda
Consider this Flux store:
```js
-let _todos = []
+const _todos = []
const TodoStore = Object.assign({}, EventEmitter.prototype, {
getAll() {
@@ -472,7 +472,7 @@ const TodoStore = Object.assign({}, EventEmitter.prototype, {
AppDispatcher.register(function (action) {
switch (action.type) {
case ActionTypes.ADD_TODO:
- let text = action.text.trim()
+ const text = action.text.trim()
_todos.push(text)
TodoStore.emitChange()
}
@@ -487,7 +487,7 @@ With Redux, the same update logic can be described as a reducing function:
export function todos(state = [], action) {
switch (action.type) {
case ActionTypes.ADD_TODO:
- let text = action.text.trim()
+ const text = action.text.trim()
return [...state, text]
default:
return state
@@ -506,7 +506,7 @@ Let's write a function that lets us express reducers as an object mapping from a
```js
export const todos = createReducer([], {
[ActionTypes.ADD_TODO]: (state, action) => {
- let text = action.text.trim()
+ const text = action.text.trim()
return [...state, text]
}
})