Skip to content

Commit 9c4f4ee

Browse files
committed
Merge latest changes
2 parents e240626 + 307c096 commit 9c4f4ee

37 files changed

+590
-363
lines changed

CONTRIBUTING.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
# Contributing
2+
We are open to, and grateful for, any contributions made by the community. By contributing to Redux, you agree to abide by the [code of conduct](https://github.com/rackt/redux/blob/master/CODE_OF_CONDUCT.md).
3+
4+
## Reporting Issues and Asking Questions
5+
Before opening an issue, please search the [issue tracker](https://github.com/rackt/redux/issues) to make sure your issue hasn't already been reported.
6+
7+
Please ask any general and implementation specific questions on [Stack Overflow with a Redux tag](http://stackoverflow.com/questions/tagged/redux?sort=votes&pageSize=50) for support.
8+
9+
## Development
10+
11+
Visit the [Issue tracker](https://github.com/rackt/redux/issues) to find a list of open issues that need attention.
12+
13+
Fork, then clone the repo:
14+
```
15+
git clone https://github.com/your-username/redux.git
16+
```
17+
18+
### Building
19+
20+
#### Build Redux
21+
22+
Running the `build` task will create both a CommonJS module-per-module build and a UMD build.
23+
```
24+
npm run build
25+
```
26+
27+
To create just a CommonJS module-per-module build:
28+
```
29+
npm run build:lib
30+
```
31+
32+
To create just a UMD build:
33+
```
34+
npm run build:umd
35+
npm run build:umd:min
36+
```
37+
38+
### Testing and Linting
39+
To run both linting and testing at once, run the following:
40+
```
41+
npm run check
42+
```
43+
44+
To only run tests:
45+
```
46+
npm run test
47+
```
48+
49+
To continuously watch and run tests, run the following:
50+
```
51+
npm run test:watch
52+
```
53+
54+
To perform linting with `eslint`, run the following:
55+
```
56+
npm run lint
57+
```
58+
59+
### Docs
60+
61+
Improvements to the documentation are always welcome. In the docs we abide by typographic rules, so
62+
instead of ' you should use ’, same for “ ” and dashes (—) where appropriate. These rules only apply to the text, not to code blocks.
63+
64+
#### Preparing to build the documentation
65+
To install the latest version of `gitbook` and prepare to build the documentation, run the following:
66+
```
67+
npm run docs:prepare
68+
```
69+
#### Building the documentation
70+
To build the documentation, run the following:
71+
```
72+
npm run docs:build
73+
```
74+
75+
To watch and re-build documentation when changes occur, run the following:
76+
```
77+
npm run docs:watch
78+
```
79+
80+
#### Publishing the documentation
81+
To publish the documentation, run the following:
82+
```
83+
npm run docs:publish
84+
```
85+
86+
#### Cleaning up built documentation
87+
To remove previously built documentation, run the following:
88+
```
89+
npm run docs:clean
90+
```
91+
92+
### Examples
93+
Redux comes with [official examples](http://rackt.github.io/redux/docs/introduction/Examples.html) to demonstrate various concepts and best practices.
94+
95+
When adding a new example, please adhere to the style and format of the existing examples, and try to reuse as much code as possible. For example, `index.html`, `server.js`, and `webpack.config.js` can typically be reused.
96+
97+
>For ease of development, the webpack configs for the examples are set up so that the `redux` module is aliased to the project `src` folder when inside of the Redux folder. If an example is moved out of the Redux folder, they will instead use the version of Redux from `node_modules`.
98+
99+
#### Building and testing the examples
100+
To build and test the official Redux examples, run the following:
101+
```
102+
npm run build:examples
103+
npm run test:examples
104+
```
105+
106+
Please visit the [Examples page](http://rackt.github.io/redux/docs/introduction/Examples.html) for information on running an individual example.
107+
108+
###New Features
109+
Please open an issue with a proposal for a new feature or refactoring before starting on the work. We don't want you to waste your efforts on a pull request that we won't want to accept.
110+
111+
###Style
112+
[rackt](https://github.com/rackt) is trying to keep a standard style across its various projects, which can be found over in [eslint-config-rackt](https://github.com/rackt/eslint-config-rackt). If you have a style change proposal, it should first be proposed there. If accepted, we will be happy to accept a PR to implement it here.
113+
114+
## Submitting Changes
115+
* Open a new issue in the [Issue tracker](https://github.com/rackt/redux/issues).
116+
* Fork the repo.
117+
* Create a new feature branch based off the `master` branch.
118+
* Make sure all tests pass and there are no linting errors.
119+
* Submit a pull request, referencing any issues it addresses.
120+
121+
Please try to keep your pull request focused in scope and avoid including unrelated commits.
122+
123+
After you have submitted your pull request, we'll try to get back to you as soon as possible. We may suggest some changes or improvements.
124+
125+
Thank you for contributing!

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ It is tiny (2kB) and has no dependencies.
1212
[![npm downloads](https://img.shields.io/npm/dm/redux.svg?style=flat-square)](https://www.npmjs.com/package/redux)
1313
[![redux channel on discord](https://img.shields.io/badge/discord-%23redux%20%40%20reactiflux-61dafb.svg?style=flat-square)](https://discord.gg/0ZcbPKXt5bZ6au5t)
1414
[![#rackt on freenode](https://img.shields.io/badge/irc-%23rackt%20%40%20freenode-61DAFB.svg?style=flat-square)](https://webchat.freenode.net/)
15+
[![Changelog #187](https://img.shields.io/badge/changelog-%23187-lightgrey.svg?style=flat-square)](https://changelog.com/187)
1516

17+
>**New! Learn Redux from its creator:
18+
>[Getting Started with Redux](https://egghead.io/series/getting-started-with-redux) (30 free videos)**
1619
1720
### Testimonials
1821

@@ -111,6 +114,31 @@ If you’re coming from Flux, there is a single important difference you need to
111114

112115
This architecture might seem like an overkill for a counter app, but the beauty of this pattern is how well it scales to large and complex apps. It also enables very powerful developer tools, because it is possible to trace every mutation to the action that caused it. You can record user sessions and reproduce them just by replaying every action.
113116

117+
### Learn Redux from Its Creator
118+
119+
[Getting Started with Redux](https://egghead.io/series/getting-started-with-redux) is a video course consisting of 30 videos narrated by Dan Abramov, author of Redux. It is designed to complement the “Basics” part of the docs while bringing additional insights about immutability, testing, Redux best practices, and using Redux with React. **This course is free and will always be.**
120+
121+
>[“Great course on egghead.io by @dan_abramov - instead of just showing you how to use #redux, it also shows how and why redux was built!”](https://twitter.com/sandrinodm/status/670548531422326785)
122+
>Sandrino Di Mattia
123+
124+
>[“Plowing through @dan_abramov 'Getting Started with Redux' - its amazing how much simpler concepts get with video.”](https://twitter.com/chrisdhanaraj/status/670328025553219584)
125+
>Chris Dhanaraj
126+
127+
>[“This video series on Redux by @dan_abramov on @eggheadio is spectacular!”](https://twitter.com/eddiezane/status/670333133242408960)
128+
>Eddie Zaneski
129+
130+
>[“Come for the name hype. Stay for the rock solid fundamentals. (Thanks, and great job @dan_abramov and @eggheadio!)”](https://twitter.com/danott/status/669909126554607617)
131+
>Dan
132+
133+
>[“This series of videos on Redux by @dan_abramov is repeatedly blowing my mind - gunna do some serious refactoring”](https://twitter.com/gelatindesign/status/669658358643892224)
134+
>Laurence Roberts
135+
136+
So, what are you waiting for?
137+
138+
#### [Watch the 30 Free Videos!](https://egghead.io/series/getting-started-with-redux)
139+
140+
If you enjoyed my course, consider supporting Egghead by [buying a subscription](https://egghead.io/pricing). Subscribers have access to the source code for the example in every one of my videos, as well as to tons of advanced lessons on other topics, including JavaScript in depth, React, Angular, and more. Many [Egghead instructors](https://egghead.io/instructors) are also open source library authors, so buying a subscription is a nice way to thank them for the work that they’ve done.
141+
114142
### Documentation
115143

116144
* [Introduction](http://rackt.github.io/redux/docs/introduction/index.html)

docs/Troubleshooting.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,20 @@ For example, a reducer like this is wrong because it mutates the state:
2020
```js
2121
function todos(state = [], action) {
2222
switch (action.type) {
23-
case 'ADD_TODO':
24-
// Wrong! This mutates state
25-
state.push({
26-
text: action.text,
27-
completed: false
28-
})
29-
case 'COMPLETE_TODO':
30-
// Wrong! This mutates state[action.index].
31-
state[action.index].completed = true
23+
case 'ADD_TODO':
24+
// Wrong! This mutates state
25+
state.push({
26+
text: action.text,
27+
completed: false
28+
})
29+
return state
30+
case 'COMPLETE_TODO':
31+
// Wrong! This mutates state[action.index].
32+
state[action.index].completed = true
33+
return state
34+
default:
35+
return state
3236
}
33-
34-
return state
3537
}
3638
```
3739

@@ -43,7 +45,7 @@ function todos(state = [], action) {
4345
case 'ADD_TODO':
4446
// Return a new array
4547
return [
46-
...state,
48+
...state,
4749
{
4850
text: action.text,
4951
completed: false

0 commit comments

Comments
 (0)