Skip to content

Commit 2cfe403

Browse files
committed
Grammar and spelling corrections
1 parent 1f4c867 commit 2cfe403

File tree

9 files changed

+48
-48
lines changed

9 files changed

+48
-48
lines changed

04_simple-reducer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var store_1 = createStore(reducer)
3131

3232
// Did you see that? our reducer is actually called even if we didn't dispatch any action...
3333
// That's because to initialize the state of the application,
34-
// Redux actually dispatch an init action ({ type: '@@redux/INIT' })
34+
// Redux actually dispatches an init action ({ type: '@@redux/INIT' })
3535

3636
// When called, a reducer is given those parameters: (state, action)
3737
// It's then very logical that at an application initialization, the state not being yet

11_state-subscriber.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Tutorial 11 - state-subscriber.js
22

3-
// We're close to have a complete Flux loop but we still miss one critical part:
3+
// We're close to having a complete Flux loop but we still miss one critical part:
44

55
// _________ _________ ___________
66
// | | | Change | | React |
@@ -62,12 +62,12 @@ store_0.dispatch(addItemActionCreator({ id: 1234, description: 'anything' }))
6262

6363
// Our subscribe callback is correctly called and our store now contains the new item that we added.
6464

65-
// Theorically speaking we could stop here. Our Flux loop is closed, we understood all concept that makes
66-
// Flux and we saw that it is not that much of a mystery. But to be honest, there is still a lot to talk
67-
// about and few things in the last example were intentionally left aside to keep the most simplest form of this
65+
// Theorically speaking we could stop here. Our Flux loop is closed, we understood all concepts that make
66+
// Flux and we saw that it is not that much of a mystery. But to be honest, there is still a lot to talk
67+
// about and a few things in the last example were intentionally left aside to keep the simplest form of this
6868
// last Flux's concept:
6969

70-
// - Our subscriber callback did not received the state as parameter, why?
70+
// - Our subscriber callback did not receive the state as a parameter, why?
7171
// - Since we did not received our new state, we were bound to exploit our closured store (store_0) so this
7272
// solution is not acceptable in a real multi-modules application...
7373
// - How do we actually update our views?
@@ -76,8 +76,8 @@ store_0.dispatch(addItemActionCreator({ id: 1234, description: 'anything' }))
7676

7777
// We're now entering a more "Redux inside React" specific domain.
7878

79-
// It is very important to understand that Redux is by no mean bound to React. It is really a
80-
// "Predictable state container for JavaScript apps" and you can use it in many ways, a React
79+
// It is very important to understand that Redux is by no means bound to React. It is really a
80+
// "Predictable state container for JavaScript apps" and you can use it in many ways, a React
8181
// application just being one of them.
8282

8383
// In that perspective we would be a bit lost if it weren't for react-redux (https://github.com/gaearon/react-redux).
@@ -88,16 +88,16 @@ store_0.dispatch(addItemActionCreator({ id: 1234, description: 'anything' }))
8888
// the same time also seems to not provide enough features?
8989

9090
// It's simplicity is actually its power! Redux, with its current minimalist API (including "subscribe") is
91-
// highly extensible and this allow to build some crazy product like the Redux DevTools
91+
// highly extensible and this allow to build some crazy products like the Redux DevTools
9292
// (https://github.com/gaearon/redux-devtools).
9393

94-
// But in the end we still need a "better" API to subscribe to our store change. That's exactly what redux-react
94+
// But in the end we still need a "better" API to subscribe to our store changes. That's exactly what redux-react
9595
// brings us: an API that will allow us to seamlessly fill the gap between the raw Redux subscribing mechanism
9696
// and our developer expectations. In the end, you won't need to use "subscribe" directly. Instead you will
9797
// use bindings such as "provide" or "connect" and those will hide from you the "subscribe" method.
9898

99-
// So yeah, the "subscribe" method will still be used but it will done through a higher order API that
100-
// handle for you the access to redux state.
99+
// So yeah, the "subscribe" method will still be used but it will be done through a higher order API that
100+
// handles access to redux state for you.
101101

102102
// We'll now cover those bindings and show how simple it is to wire your components to Redux's state.
103103

12_Provider-and-connect.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
// - The awesome Webpack (http://webpack.github.io/) to bundle our application,
1414
// - The magic Webpack Dev Server (http://webpack.github.io/docs/webpack-dev-server.html)
1515
// to serve JS files from a dedicated node server that allows for files watch
16-
// - The incredible React Hot Loader http://gaearon.github.io/react-hot-loader/ (another awesome
17-
// project of Dan Abramov - just in case, he is Redux's author) to have a crazy
18-
// DX (Developer experience) by having our components to live-reload in browser
16+
// - The incredible React Hot Loader http://gaearon.github.io/react-hot-loader/ (another awesome
17+
// project of Dan Abramov - just in case, he is Redux's author) to have a crazy
18+
// DX (Developer experience) by having our components live-reload in the browser
1919
// while we're tweaking them in our code editor.
2020

2121
// I won't detail Webpack Dev Server and React Hot Loader setup here since it's done pretty

12_src/src/action-creators.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// use any promise lib you want.
55
import Promise from 'bluebird'
66

7-
// Our action creator just get the current time in a delayd fashion to illustrate the use of the promise
7+
// Our action creator just gets the current time in a delayed fashion to illustrate the use of the promise
88
// middleware.
99

1010
// The promise middleware works by waiting either:
@@ -16,7 +16,7 @@ import Promise from 'bluebird'
1616
// }
1717
// }
1818
// 2) or anything else what would be passed to the next middleware or to Redux (actually, with this
19-
// implementation of the promise middleware, the "anything else" have to NOT contain a promise
19+
// implementation of the promise middleware, the "anything else" has to NOT contain a promise
2020
// property to be passed to the next middleware or Redux)
2121

2222
// When the promise middleware receives this action, it will create 2 actions from this one:
@@ -25,8 +25,8 @@ import Promise from 'bluebird'
2525
// Again, the code for the promise middleware is not complicated and it is worth having a look
2626
// at it (./promise-middleware.js)
2727

28-
// The action is delayed by "delay" ms passed as a parameter of the action creator. Try to change
29-
// this value to verify that the delay correctly impact our UI.
28+
// The action is delayed by "delay" ms passed as a parameter of the action creator. Try to change
29+
// this value to verify that the delay correctly impacts our UI.
3030
export function getTime(delay = 100) {
3131
return {
3232
types: ['GET_TIME_REQUEST', 'GET_TIME_SUCCESS', 'GET_TIME_FAILURE'],

12_src/src/application.jsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
// brings to us: the Provider component.
55

66
// Provider is a React Component designed to be used as a wrapper of your application's root component. Its
7-
// purpose is to provide your redux instance to all your application's components. How it does that does not
8-
// really matters to us but just to let you know, it's using React's context feature (it's undocumented so you
9-
// don't have to know about it but if you're curious:
7+
// purpose is to provide your redux instance to all of your application's components. How it does that does not
8+
// really matter to us but just to let you know, it's using React's context feature (it's undocumented so you
9+
// don't have to know about it, but if you're curious:
1010
// https://www.tildedave.com/2014/11/15/introduction-to-contexts-in-react-js.html).
1111

1212
import React from 'react'
@@ -17,11 +17,11 @@ export default class Application extends React.Component {
1717
render () {
1818
return (
1919
// As explained above, the Provider must wrap your application's Root component. This way,
20-
// this component and all of its children (even deeply nested ones) will have access to your
21-
// Redux store. Of course, to allow Provider do do that, you must give to him the store
22-
// you built precedently (via a "store" props).
20+
// this component and all of its children (even deeply nested ones) will have access to your
21+
// Redux store. Of course, to allow Provider to do that, you must give to him the store
22+
// you built previously (via a "store" props).
2323
// That's almost all there is to say about Provider... One last word though:
24-
// You'll notice in the code above that Provider needs to have as its child, a function that return
24+
// You'll notice in the code above that Provider needs to have as its child, a function that returns
2525
// the root component instead of the component itself. This is a temporary API until React 0.14 comes
2626
// out, to fix a React 0.13 context issue.
2727
<Provider store={ this.props.store }>

12_src/src/create-store.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@
66
// One thing to notice though: we're not using the thunk middleware that we've seen before. Instead
77
// we use a promise middleware solution that will allow us to handle asynchronous action creators and
88
// to do some nice real time updates on our UI (could also be some optimistic updates).
9-
// This middleware was discussed here: https://github.com/gaearon/redux/issues/99 and it is used
9+
// This middleware was discussed here: https://github.com/gaearon/redux/issues/99 and it is used
1010
// in this very good react-redux-universal-example: https://github.com/erikras/react-redux-universal-hot-example
1111
// that I strongly suggest you get a look at (later, not right now ;)).
1212

1313
import { createStore, applyMiddleware, combineReducers } from 'redux'
14-
// You can go and see code for this middleware, it's not very complicated and make a good
14+
// You can go and see code for this middleware, it's not very complicated and makes a good
1515
// excercise to sharpen your understanding on middlewares.
1616
import promiseMiddleware from './promise-middleware'
17-
// We'll just have one reducer in this application but the ES6 import notation below is
17+
// We'll just have one reducer in this application but the ES6 import notation below is
1818
// pretty interesting to import and produce a reducers hash in one go. Have a look in
1919
// ./reducers.js to see what our reducer actually do (no magic there).
2020
import * as reducers from './reducers'
2121

2222
// The data parameter that we see here is used to initialize our redux store with data. This was
23-
// not spoken of yet for simplicity but it is thanks to that, that your reducers can be initialized
24-
// with real data if you already have some. For example in an isomorphic/universal app where you
25-
// fetched data server-side, serialized and passed them to the client, your Redux store can be
26-
// initialized with those data.
23+
// not spoken of yet for simplicity but thanks to it your reducers can be initialized
24+
// with real data if you already have some. For example in an isomorphic/universal app where you
25+
// fetch data server-side, serialize and pass it to the client, your Redux store can be
26+
// initialized with that data.
2727
// We're not passing any data here but it's good that you know of this createStore's ability.
2828
export default function(data) {
2929
var reducer = combineReducers(reducers)

12_src/src/home.jsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@
88
// As we explained previously, when using the Provider component, we allow all components of our app to
99
// access Redux. But this access can only be made through the undocumented feature "React's context". To
1010
// avoid asking you to use such "dark" React API, Redux is exposing a decorator (an ES7 feature that
11-
// make it possible to annotate and modify classes and properties at design time -
11+
// makes it possible to annotate and modify classes and properties at design time -
1212
// https://github.com/wycats/javascript-decorators) that you can use on a component class.
1313

14-
// The "connect" decorator litteraly connects your component with your Redux's store. By doing so,
15-
// it provides your store's dispatch function through a component's prop and add also any
14+
// The "connect" decorator literally connects your component with your Redux's store. By doing so,
15+
// it provides your store's dispatch function through a component's prop and also adds any
1616
// properties you want to expose part of your store's state.
1717

1818
// Using @connect, you'll turn a dumb component (https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0),
1919
// into a smart component with very little code overhead.
2020

2121
import React from 'react'
2222
import { connect } from 'react-redux'
23-
// We use the same ES6 import trick to get all action creators and produce a hash than we did with
23+
// We use the same ES6 import trick to get all action creators and produce a hash like we did with
2424
// our reducers. If you haven't yet, go get a look at our action creator (./actions-creator.js).
2525
import * as actionCreators from './action-creators'
2626

27-
// The "connect" decorator takes as only parameter, a function that will select which slice of your
28-
// state you want to expose to you component. This function is logically called a "selector" and
29-
// receive 2 parameters: the state of your store and the current props of your component.
27+
// The "connect" decorator takes as its only parameter, a function that will select which slice of your
28+
// state you want to expose to your component. This function is logically called a "selector" and
29+
// receives 2 parameters: the state of your store and the current props of your component.
3030
// The props of the component are provided to handle common case like extracting a slice of your
3131
// state depending on a prop value (Ex: state.items[props.someID]).
3232
@connect((state /*, props*/) => {
@@ -40,13 +40,13 @@ import * as actionCreators from './action-creators'
4040
})
4141
export default class Home extends React.Component {
4242
onTimeButtonClick () {
43-
// This button handler is the one that will dispatch an action in response to a
43+
// This button handler will dispatch an action in response to a
4444
// click event from a user. We use here the dispatch function provided by @connect in a prop.
4545
this.props.dispatch(actionCreators.getTime())
4646
}
4747
render () {
4848

49-
// Thanks to our @connect decorator, we're able to get through props, data previously selected.
49+
// Thanks to our @connect decorator, we're able to get the data previously selected through the props.
5050
var { frozen, time, reduxState } = this.props
5151
var attrs = {}
5252

12_src/src/index.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Tutorial 12 - Provider-and-connect.js
22

33
// This file is the entry point of our JS bundle. It's here that we'll create our Redux store,
4-
// instanciate our React Application root component and attach it to the DOM.
4+
// instantiate our React Application root component and attach it to the DOM.
55

66
import React from 'react'
77
// All store creation specific code is located in ./create-store.js
@@ -10,8 +10,8 @@ import createStore from './create-store'
1010
import Application from './application'
1111

1212
// Just as we did so many times in previous examples, we need to create our redux instance. This time
13-
// all code for that task was moved to a specific module that return a single function to trigger the
14-
// initialisation.
13+
// all code for that task was moved to a specific module that returns a single function to trigger the
14+
// instantiation.
1515
const store = createStore()
1616

1717
// Now, time to render our application to the DOM...

12_src/src/reducers.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Tutorial 12 - Provider-and-connect.js
22

3-
// This file holds the one an only reducer of our application. Its behavior is nothing new to you
4-
// except maybe its handling of three aspect of an action (GET_TIME) that become 3 dedicated actions...
5-
// This approach allows us to do some nice real time update on our UI like this:
3+
// This file holds the one and only reducer of our application. Its behavior is nothing new to you
4+
// except maybe its handling of three aspects of an action (GET_TIME) that become 3 dedicated actions...
5+
// This approach allows us to do some nice real time updates in our UI like this:
66
// 1) When we receive GET_TIME_REQUEST action, we modify the state to say that some part of the
77
// UI should be frozen (because there is a pending operation)
88
// 2) When we receive GET_TIME_SUCCESS (or GET_TIME_FAILURE) later on, we modify the state to

0 commit comments

Comments
 (0)