redux-3.6.0.zip

a3737337ZIPredux-3.6.0.zip  562.87KB

资源文件列表:

ZIP redux-3.6.0.zip 大约有332个文件
  1. redux-3.6.0/
  2. redux-3.6.0/.babelrc 1.09KB
  3. redux-3.6.0/.editorconfig 304B
  4. redux-3.6.0/.eslintignore 80B
  5. redux-3.6.0/.eslintrc 254B
  6. redux-3.6.0/.github/
  7. redux-3.6.0/.github/ISSUE_TEMPLATE.md 708B
  8. redux-3.6.0/.gitignore 56B
  9. redux-3.6.0/.travis.yml 517B
  10. redux-3.6.0/CHANGELOG.md 225B
  11. redux-3.6.0/CNAME 13B
  12. redux-3.6.0/CODE_OF_CONDUCT.md 3.15KB
  13. redux-3.6.0/CONTRIBUTING.md 5.82KB
  14. redux-3.6.0/LICENSE-logo.md 6.8KB
  15. redux-3.6.0/LICENSE.md 1.06KB
  16. redux-3.6.0/PATRONS.md 801B
  17. redux-3.6.0/README.md 14.29KB
  18. redux-3.6.0/SUMMARY.md 14B
  19. redux-3.6.0/book.json 455B
  20. redux-3.6.0/build/
  21. redux-3.6.0/build/gitbook.css 160B
  22. redux-3.6.0/build/use-lodash-es.js 223B
  23. redux-3.6.0/docs/
  24. redux-3.6.0/docs/FAQ.md 54.83KB
  25. redux-3.6.0/docs/Feedback.md 425B
  26. redux-3.6.0/docs/Glossary.md 8.04KB
  27. redux-3.6.0/docs/README.md 1.99KB
  28. redux-3.6.0/docs/Troubleshooting.md 6.24KB
  29. redux-3.6.0/docs/advanced/
  30. redux-3.6.0/docs/advanced/AsyncActions.md 19.31KB
  31. redux-3.6.0/docs/advanced/AsyncFlow.md 1.44KB
  32. redux-3.6.0/docs/advanced/ExampleRedditAPI.md 7.71KB
  33. redux-3.6.0/docs/advanced/Middleware.md 16.27KB
  34. redux-3.6.0/docs/advanced/NextSteps.md 101B
  35. redux-3.6.0/docs/advanced/README.md 421B
  36. redux-3.6.0/docs/advanced/UsageWithReactRouter.md 7.76KB
  37. redux-3.6.0/docs/api/
  38. redux-3.6.0/docs/api/README.md 1.24KB
  39. redux-3.6.0/docs/api/Store.md 8.36KB
  40. redux-3.6.0/docs/api/applyMiddleware.md 9.66KB
  41. redux-3.6.0/docs/api/bindActionCreators.md 3.89KB
  42. redux-3.6.0/docs/api/combineReducers.md 5.07KB
  43. redux-3.6.0/docs/api/compose.md 1.42KB
  44. redux-3.6.0/docs/api/createStore.md 3.12KB
  45. redux-3.6.0/docs/basics/
  46. redux-3.6.0/docs/basics/Actions.md 4.63KB
  47. redux-3.6.0/docs/basics/DataFlow.md 4.86KB
  48. redux-3.6.0/docs/basics/ExampleTodoList.md 6.27KB
  49. redux-3.6.0/docs/basics/README.md 489B
  50. redux-3.6.0/docs/basics/Reducers.md 14.28KB
  51. redux-3.6.0/docs/basics/Store.md 3.07KB
  52. redux-3.6.0/docs/basics/UsageWithReact.md 15.09KB
  53. redux-3.6.0/docs/introduction/
  54. redux-3.6.0/docs/introduction/Ecosystem.md 12.17KB
  55. redux-3.6.0/docs/introduction/Examples.md 5.47KB
  56. redux-3.6.0/docs/introduction/Motivation.md 2.33KB
  57. redux-3.6.0/docs/introduction/PriorArt.md 7.08KB
  58. redux-3.6.0/docs/introduction/README.md 169B
  59. redux-3.6.0/docs/introduction/ThreePrinciples.md 3.17KB
  60. redux-3.6.0/docs/recipes/
  61. redux-3.6.0/docs/recipes/ComputingDerivedData.md 11.12KB
  62. redux-3.6.0/docs/recipes/ImplementingUndoHistory.md 15.52KB
  63. redux-3.6.0/docs/recipes/IsolatingSubapps.md 2.47KB
  64. redux-3.6.0/docs/recipes/MigratingToRedux.md 2.62KB
  65. redux-3.6.0/docs/recipes/README.md 605B
  66. redux-3.6.0/docs/recipes/ReducingBoilerplate.md 16.88KB
  67. redux-3.6.0/docs/recipes/ServerRendering.md 14.69KB
  68. redux-3.6.0/docs/recipes/UsingObjectSpreadOperator.md 2.88KB
  69. redux-3.6.0/docs/recipes/WritingTests.md 12.48KB
  70. redux-3.6.0/examples/
  71. redux-3.6.0/examples/README.md 124B
  72. redux-3.6.0/examples/async/
  73. redux-3.6.0/examples/async/.gitignore 155B
  74. redux-3.6.0/examples/async/README.md 1.55KB
  75. redux-3.6.0/examples/async/index.html 634B
  76. redux-3.6.0/examples/async/package.json 523B
  77. redux-3.6.0/examples/async/src/
  78. redux-3.6.0/examples/async/src/actions/
  79. redux-3.6.0/examples/async/src/actions/index.js 1.25KB
  80. redux-3.6.0/examples/async/src/components/
  81. redux-3.6.0/examples/async/src/components/Picker.js 668B
  82. redux-3.6.0/examples/async/src/components/Posts.js 314B
  83. redux-3.6.0/examples/async/src/containers/
  84. redux-3.6.0/examples/async/src/containers/App.js 2.47KB
  85. redux-3.6.0/examples/async/src/index.js 577B
  86. redux-3.6.0/examples/async/src/reducers/
  87. redux-3.6.0/examples/async/src/reducers/index.js 1.23KB
  88. redux-3.6.0/examples/buildAll.js 1008B
  89. redux-3.6.0/examples/counter-vanilla/
  90. redux-3.6.0/examples/counter-vanilla/index.html 1.76KB
  91. redux-3.6.0/examples/counter/
  92. redux-3.6.0/examples/counter/.gitignore 155B
  93. redux-3.6.0/examples/counter/README.md 1.55KB
  94. redux-3.6.0/examples/counter/index.html 636B
  95. redux-3.6.0/examples/counter/package.json 566B
  96. redux-3.6.0/examples/counter/src/
  97. redux-3.6.0/examples/counter/src/components/
  98. redux-3.6.0/examples/counter/src/components/Counter.js 1.09KB
  99. redux-3.6.0/examples/counter/src/components/Counter.spec.js 1.77KB
  100. redux-3.6.0/examples/counter/src/index.js 527B
  101. redux-3.6.0/examples/counter/src/reducers/
  102. redux-3.6.0/examples/counter/src/reducers/index.js 206B
  103. redux-3.6.0/examples/counter/src/reducers/index.spec.js 537B
  104. redux-3.6.0/examples/real-world/
  105. redux-3.6.0/examples/real-world/.gitignore 155B
  106. redux-3.6.0/examples/real-world/README.md 1.55KB
  107. redux-3.6.0/examples/real-world/index.html 624B
  108. redux-3.6.0/examples/real-world/package.json 766B
  109. redux-3.6.0/examples/real-world/src/
  110. redux-3.6.0/examples/real-world/src/actions/
  111. redux-3.6.0/examples/real-world/src/actions/index.js 3.9KB
  112. redux-3.6.0/examples/real-world/src/components/
  113. redux-3.6.0/examples/real-world/src/components/Explore.js 1.52KB
  114. redux-3.6.0/examples/real-world/src/components/List.js 1.24KB
  115. redux-3.6.0/examples/real-world/src/components/Repo.js 805B
  116. redux-3.6.0/examples/real-world/src/components/User.js 646B
  117. redux-3.6.0/examples/real-world/src/containers/
  118. redux-3.6.0/examples/real-world/src/containers/App.js 1.62KB
  119. redux-3.6.0/examples/real-world/src/containers/DevTools.js 337B
  120. redux-3.6.0/examples/real-world/src/containers/RepoPage.js 2.58KB
  121. redux-3.6.0/examples/real-world/src/containers/Root.dev.js 576B
  122. redux-3.6.0/examples/real-world/src/containers/Root.js 139B
  123. redux-3.6.0/examples/real-world/src/containers/Root.prod.js 488B
  124. redux-3.6.0/examples/real-world/src/containers/UserPage.js 2.53KB
  125. redux-3.6.0/examples/real-world/src/index.js 435B
  126. redux-3.6.0/examples/real-world/src/middleware/
  127. redux-3.6.0/examples/real-world/src/middleware/api.js 3.72KB
  128. redux-3.6.0/examples/real-world/src/reducers/
  129. redux-3.6.0/examples/real-world/src/reducers/index.js 1.36KB
  130. redux-3.6.0/examples/real-world/src/reducers/paginate.js 1.75KB
  131. redux-3.6.0/examples/real-world/src/routes.js 382B
  132. redux-3.6.0/examples/real-world/src/store/
  133. redux-3.6.0/examples/real-world/src/store/configureStore.dev.js 738B
  134. redux-3.6.0/examples/real-world/src/store/configureStore.js 159B
  135. redux-3.6.0/examples/real-world/src/store/configureStore.prod.js 314B
  136. redux-3.6.0/examples/shopping-cart/
  137. redux-3.6.0/examples/shopping-cart/.gitignore 155B
  138. redux-3.6.0/examples/shopping-cart/README.md 1.56KB
  139. redux-3.6.0/examples/shopping-cart/index.html 642B
  140. redux-3.6.0/examples/shopping-cart/package.json 631B
  141. redux-3.6.0/examples/shopping-cart/src/
  142. redux-3.6.0/examples/shopping-cart/src/actions/
  143. redux-3.6.0/examples/shopping-cart/src/actions/index.js 1.03KB
  144. redux-3.6.0/examples/shopping-cart/src/api/
  145. redux-3.6.0/examples/shopping-cart/src/api/products.json 229B
  146. redux-3.6.0/examples/shopping-cart/src/api/shop.js 305B
  147. redux-3.6.0/examples/shopping-cart/src/components/
  148. redux-3.6.0/examples/shopping-cart/src/components/Cart.js 906B
  149. redux-3.6.0/examples/shopping-cart/src/components/Cart.spec.js 1.72KB
  150. redux-3.6.0/examples/shopping-cart/src/components/Product.js 362B
  151. redux-3.6.0/examples/shopping-cart/src/components/Product.spec.js 726B
  152. redux-3.6.0/examples/shopping-cart/src/components/ProductItem.js 813B
  153. redux-3.6.0/examples/shopping-cart/src/components/ProductItem.spec.js 1.64KB
  154. redux-3.6.0/examples/shopping-cart/src/components/ProductsList.js 342B
  155. redux-3.6.0/examples/shopping-cart/src/components/ProductsList.spec.js 720B
  156. redux-3.6.0/examples/shopping-cart/src/constants/
  157. redux-3.6.0/examples/shopping-cart/src/constants/ActionTypes.js 245B
  158. redux-3.6.0/examples/shopping-cart/src/containers/
  159. redux-3.6.0/examples/shopping-cart/src/containers/App.js 369B
  160. redux-3.6.0/examples/shopping-cart/src/containers/CartContainer.js 983B
  161. redux-3.6.0/examples/shopping-cart/src/containers/ProductsContainer.js 1.13KB
  162. redux-3.6.0/examples/shopping-cart/src/index.js 656B
  163. redux-3.6.0/examples/shopping-cart/src/reducers/
  164. redux-3.6.0/examples/shopping-cart/src/reducers/cart.js 1.19KB
  165. redux-3.6.0/examples/shopping-cart/src/reducers/cart.spec.js 1.15KB
  166. redux-3.6.0/examples/shopping-cart/src/reducers/index.js 769B
  167. redux-3.6.0/examples/shopping-cart/src/reducers/index.spec.js 1.54KB
  168. redux-3.6.0/examples/shopping-cart/src/reducers/products.js 1.17KB
  169. redux-3.6.0/examples/shopping-cart/src/reducers/products.spec.js 1.11KB
  170. redux-3.6.0/examples/testAll.js 1001B
  171. redux-3.6.0/examples/todomvc/
  172. redux-3.6.0/examples/todomvc/.gitignore 155B
  173. redux-3.6.0/examples/todomvc/README.md 1.55KB
  174. redux-3.6.0/examples/todomvc/index.html 652B
  175. redux-3.6.0/examples/todomvc/package.json 627B
  176. redux-3.6.0/examples/todomvc/src/
  177. redux-3.6.0/examples/todomvc/src/actions/
  178. redux-3.6.0/examples/todomvc/src/actions/index.js 520B
  179. redux-3.6.0/examples/todomvc/src/actions/index.spec.js 1.12KB
  180. redux-3.6.0/examples/todomvc/src/components/
  181. redux-3.6.0/examples/todomvc/src/components/Footer.js 1.77KB
  182. redux-3.6.0/examples/todomvc/src/components/Footer.spec.js 3.19KB
  183. redux-3.6.0/examples/todomvc/src/components/Header.js 578B
  184. redux-3.6.0/examples/todomvc/src/components/Header.spec.js 1.25KB
  185. redux-3.6.0/examples/todomvc/src/components/MainSection.js 2.06KB
  186. redux-3.6.0/examples/todomvc/src/components/MainSection.spec.js 3.83KB
  187. redux-3.6.0/examples/todomvc/src/components/TodoItem.js 1.65KB
  188. redux-3.6.0/examples/todomvc/src/components/TodoItem.spec.js 3.33KB
  189. redux-3.6.0/examples/todomvc/src/components/TodoTextInput.js 1.24KB
  190. redux-3.6.0/examples/todomvc/src/components/TodoTextInput.spec.js 2.43KB
  191. redux-3.6.0/examples/todomvc/src/constants/
  192. redux-3.6.0/examples/todomvc/src/constants/ActionTypes.js 250B
  193. redux-3.6.0/examples/todomvc/src/constants/TodoFilters.js 123B
  194. redux-3.6.0/examples/todomvc/src/containers/
  195. redux-3.6.0/examples/todomvc/src/containers/App.js 863B
  196. redux-3.6.0/examples/todomvc/src/index.js 374B
  197. redux-3.6.0/examples/todomvc/src/reducers/
  198. redux-3.6.0/examples/todomvc/src/reducers/index.js 146B
  199. redux-3.6.0/examples/todomvc/src/reducers/todos.js 1.2KB
  200. redux-3.6.0/examples/todomvc/src/reducers/todos.spec.js 5KB
  201. redux-3.6.0/examples/todos-with-undo/
  202. redux-3.6.0/examples/todos-with-undo/.gitignore 155B
  203. redux-3.6.0/examples/todos-with-undo/README.md 1.56KB
  204. redux-3.6.0/examples/todos-with-undo/index.html 644B
  205. redux-3.6.0/examples/todos-with-undo/package.json 508B
  206. redux-3.6.0/examples/todos-with-undo/src/
  207. redux-3.6.0/examples/todos-with-undo/src/actions/
  208. redux-3.6.0/examples/todos-with-undo/src/actions/index.js 323B
  209. redux-3.6.0/examples/todos-with-undo/src/components/
  210. redux-3.6.0/examples/todos-with-undo/src/components/App.js 338B
  211. redux-3.6.0/examples/todos-with-undo/src/components/Footer.js 387B
  212. redux-3.6.0/examples/todos-with-undo/src/components/Link.js 449B
  213. redux-3.6.0/examples/todos-with-undo/src/components/Todo.js 379B
  214. redux-3.6.0/examples/todos-with-undo/src/components/TodoList.js 551B
  215. redux-3.6.0/examples/todos-with-undo/src/containers/
  216. redux-3.6.0/examples/todos-with-undo/src/containers/AddTodo.js 581B
  217. redux-3.6.0/examples/todos-with-undo/src/containers/FilterLink.js 500B
  218. redux-3.6.0/examples/todos-with-undo/src/containers/UndoRedo.js 763B
  219. redux-3.6.0/examples/todos-with-undo/src/containers/VisibleTodoList.js 810B
  220. redux-3.6.0/examples/todos-with-undo/src/index.js 339B
  221. redux-3.6.0/examples/todos-with-undo/src/reducers/
  222. redux-3.6.0/examples/todos-with-undo/src/reducers/index.js 208B
  223. redux-3.6.0/examples/todos-with-undo/src/reducers/todos.js 819B
  224. redux-3.6.0/examples/todos-with-undo/src/reducers/visibilityFilter.js 216B
  225. redux-3.6.0/examples/todos/
  226. redux-3.6.0/examples/todos/.gitignore 155B
  227. redux-3.6.0/examples/todos/README.md 1.55KB
  228. redux-3.6.0/examples/todos/index.html 634B
  229. redux-3.6.0/examples/todos/package.json 564B
  230. redux-3.6.0/examples/todos/src/
  231. redux-3.6.0/examples/todos/src/actions/
  232. redux-3.6.0/examples/todos/src/actions/index.js 323B
  233. redux-3.6.0/examples/todos/src/actions/index.spec.js 618B
  234. redux-3.6.0/examples/todos/src/components/
  235. redux-3.6.0/examples/todos/src/components/App.js 275B
  236. redux-3.6.0/examples/todos/src/components/Footer.js 387B
  237. redux-3.6.0/examples/todos/src/components/Link.js 449B
  238. redux-3.6.0/examples/todos/src/components/Todo.js 379B
  239. redux-3.6.0/examples/todos/src/components/TodoList.js 551B
  240. redux-3.6.0/examples/todos/src/containers/
  241. redux-3.6.0/examples/todos/src/containers/AddTodo.js 581B
  242. redux-3.6.0/examples/todos/src/containers/FilterLink.js 500B
  243. redux-3.6.0/examples/todos/src/containers/VisibleTodoList.js 802B
  244. redux-3.6.0/examples/todos/src/index.js 339B
  245. redux-3.6.0/examples/todos/src/reducers/
  246. redux-3.6.0/examples/todos/src/reducers/index.js 208B
  247. redux-3.6.0/examples/todos/src/reducers/todos.js 687B
  248. redux-3.6.0/examples/todos/src/reducers/todos.spec.js 1.87KB
  249. redux-3.6.0/examples/todos/src/reducers/visibilityFilter.js 216B
  250. redux-3.6.0/examples/tree-view/
  251. redux-3.6.0/examples/tree-view/.gitignore 155B
  252. redux-3.6.0/examples/tree-view/README.md 1.55KB
  253. redux-3.6.0/examples/tree-view/index.html 638B
  254. redux-3.6.0/examples/tree-view/package.json 596B
  255. redux-3.6.0/examples/tree-view/src/
  256. redux-3.6.0/examples/tree-view/src/actions/
  257. redux-3.6.0/examples/tree-view/src/actions/index.js 711B
  258. redux-3.6.0/examples/tree-view/src/containers/
  259. redux-3.6.0/examples/tree-view/src/containers/Node.js 1.89KB
  260. redux-3.6.0/examples/tree-view/src/containers/Node.spec.js 2.55KB
  261. redux-3.6.0/examples/tree-view/src/generateTree.js 352B
  262. redux-3.6.0/examples/tree-view/src/index.js 425B
  263. redux-3.6.0/examples/tree-view/src/reducers/
  264. redux-3.6.0/examples/tree-view/src/reducers/index.js 1.4KB
  265. redux-3.6.0/examples/tree-view/src/reducers/index.spec.js 3.25KB
  266. redux-3.6.0/examples/universal/
  267. redux-3.6.0/examples/universal/.babelrc 36B
  268. redux-3.6.0/examples/universal/client/
  269. redux-3.6.0/examples/universal/client/index.js 452B
  270. redux-3.6.0/examples/universal/common/
  271. redux-3.6.0/examples/universal/common/actions/
  272. redux-3.6.0/examples/universal/common/actions/index.js 718B
  273. redux-3.6.0/examples/universal/common/api/
  274. redux-3.6.0/examples/universal/common/api/counter.js 446B
  275. redux-3.6.0/examples/universal/common/components/
  276. redux-3.6.0/examples/universal/common/components/Counter.js 817B
  277. redux-3.6.0/examples/universal/common/containers/
  278. redux-3.6.0/examples/universal/common/containers/App.js 416B
  279. redux-3.6.0/examples/universal/common/reducers/
  280. redux-3.6.0/examples/universal/common/reducers/counter.js 348B
  281. redux-3.6.0/examples/universal/common/reducers/index.js 152B
  282. redux-3.6.0/examples/universal/common/store/
  283. redux-3.6.0/examples/universal/common/store/configureStore.js 536B
  284. redux-3.6.0/examples/universal/index.js 20B
  285. redux-3.6.0/examples/universal/package.json 1.03KB
  286. redux-3.6.0/examples/universal/server/
  287. redux-3.6.0/examples/universal/server/index.js 46B
  288. redux-3.6.0/examples/universal/server/server.js 2.32KB
  289. redux-3.6.0/examples/universal/webpack.config.js 640B
  290. redux-3.6.0/index.d.ts 16.21KB
  291. redux-3.6.0/logo/
  292. redux-3.6.0/logo/README.md 1.79KB
  293. redux-3.6.0/logo/apple-touch-icon.png 18.73KB
  294. redux-3.6.0/logo/favicon.ico 4.19KB
  295. redux-3.6.0/logo/logo-title-dark.png 96.48KB
  296. redux-3.6.0/logo/logo-title-light.png 96.33KB
  297. redux-3.6.0/logo/logo.png 212.88KB
  298. redux-3.6.0/logo/logo.svg 1.12KB
  299. redux-3.6.0/package.json 4.98KB
  300. redux-3.6.0/src/
  301. redux-3.6.0/src/applyMiddleware.js 1.21KB
  302. redux-3.6.0/src/bindActionCreators.js 1.9KB
  303. redux-3.6.0/src/combineReducers.js 5.39KB
  304. redux-3.6.0/src/compose.js 749B
  305. redux-3.6.0/src/createStore.js 8.45KB
  306. redux-3.6.0/src/index.js 1.09KB
  307. redux-3.6.0/src/utils/
  308. redux-3.6.0/src/utils/warning.js 635B
  309. redux-3.6.0/test/
  310. redux-3.6.0/test/.eslintrc 37B
  311. redux-3.6.0/test/applyMiddleware.spec.js 2.77KB
  312. redux-3.6.0/test/bindActionCreators.spec.js 2.72KB
  313. redux-3.6.0/test/combineReducers.spec.js 7.79KB
  314. redux-3.6.0/test/compose.spec.js 1.26KB
  315. redux-3.6.0/test/createStore.spec.js 18.38KB
  316. redux-3.6.0/test/helpers/
  317. redux-3.6.0/test/helpers/actionCreators.js 727B
  318. redux-3.6.0/test/helpers/actionTypes.js 178B
  319. redux-3.6.0/test/helpers/middleware.js 166B
  320. redux-3.6.0/test/helpers/reducers.js 1.04KB
  321. redux-3.6.0/test/typescript.spec.js 309B
  322. redux-3.6.0/test/typescript/
  323. redux-3.6.0/test/typescript/actionCreators.ts 1.45KB
  324. redux-3.6.0/test/typescript/actions.ts 948B
  325. redux-3.6.0/test/typescript/compose.ts 1.28KB
  326. redux-3.6.0/test/typescript/dispatch.ts 466B
  327. redux-3.6.0/test/typescript/middleware.ts 1.6KB
  328. redux-3.6.0/test/typescript/reducers.ts 1.06KB
  329. redux-3.6.0/test/typescript/store.ts 1.32KB
  330. redux-3.6.0/test/utils/
  331. redux-3.6.0/test/utils/warning.spec.js 1.05KB
  332. redux-3.6.0/webpack.config.js 693B

资源介绍:

一个可预测的全局状态管理的 JS 库 A JS library for predictable global state management

# <a href='http://redux.js.org'><img src='https://camo.githubusercontent.com/f28b5bc7822f1b7bb28a96d8d09e7d79169248fc/687474703a2f2f692e696d6775722e636f6d2f4a65567164514d2e706e67' height='60'></a> Redux is a predictable state container for JavaScript apps. (If you're looking for a WordPress framework, check out [Redux Framework](https://reduxframework.com/).) It helps you write applications that behave consistently, run in different environments (client, server, and native), and are easy to test. On top of that, it provides a great developer experience, such as [live code editing combined with a time traveling debugger](https://github.com/gaearon/redux-devtools). You can use Redux together with [React](https://facebook.github.io/react/), or with any other view library. It is tiny (2kB, including dependencies). [![build status](https://img.shields.io/travis/reactjs/redux/master.svg?style=flat-square)](https://travis-ci.org/reactjs/redux) [![npm version](https://img.shields.io/npm/v/redux.svg?style=flat-square)](https://www.npmjs.com/package/redux) [![npm downloads](https://img.shields.io/npm/dm/redux.svg?style=flat-square)](https://www.npmjs.com/package/redux) [![redux channel on discord](https://img.shields.io/badge/discord-%23redux%20%40%20reactiflux-61dafb.svg?style=flat-square)](https://discord.gg/0ZcbPKXt5bZ6au5t) [![#rackt on freenode](https://img.shields.io/badge/irc-%23rackt%20%40%20freenode-61DAFB.svg?style=flat-square)](https://webchat.freenode.net/) [![Changelog #187](https://img.shields.io/badge/changelog-%23187-lightgrey.svg?style=flat-square)](https://changelog.com/187) >**New! Learn Redux from its creator: >[Getting Started with Redux](https://egghead.io/series/getting-started-with-redux) (30 free videos)** ### Testimonials >[“Love what you're doing with Redux”](https://twitter.com/jingc/status/616608251463909376) >Jing Chen, creator of Flux >[“I asked for comments on Redux in FB's internal JS discussion group, and it was universally praised. Really awesome work.”](https://twitter.com/fisherwebdev/status/616286955693682688) >Bill Fisher, author of Flux documentation >[“It's cool that you are inventing a better Flux by not doing Flux at all.”](https://twitter.com/andrestaltz/status/616271392930201604) >André Staltz, creator of Cycle ### Developer Experience I wrote Redux while working on my React Europe talk called [“Hot Reloading with Time Travel”](https://www.youtube.com/watch?v=xsSnOQynTHs). My goal was to create a state management library with minimal API but completely predictable behavior, so it is possible to implement logging, hot reloading, time travel, universal apps, record and replay, without any buy-in from the developer. ### Influences Redux evolves the ideas of [Flux](http://facebook.github.io/flux/), but avoids its complexity by taking cues from [Elm](https://github.com/evancz/elm-architecture-tutorial/). Whether you have used them or not, Redux only takes a few minutes to get started with. ### Installation To install the stable version: ``` npm install --save redux ``` This assumes you are using [npm](https://www.npmjs.com/) as your package manager. If you don't, you can [access these files on unpkg](https://unpkg.com/redux/), download them, or point your package manager to them. Most commonly people consume Redux as a collection of [CommonJS](http://webpack.github.io/docs/commonjs.html) modules. These modules are what you get when you import `redux` in a [Webpack](http://webpack.github.io), [Browserify](http://browserify.org/), or a Node environment. If you like to live on the edge and use [Rollup](http://rollupjs.org), we support that as well. If you don't use a module bundler, it's also fine. The `redux` npm package includes precompiled production and development [UMD](https://github.com/umdjs/umd) builds in the [`dist` folder](https://unpkg.com/redux/dist/). They can be used directly without a bundler and are thus compatible with many popular JavaScript module loaders and environments. For example, you can drop a UMD build as a [`<script>` tag](https://unpkg.com/redux/dist/redux.js) on the page, or [tell Bower to install it](https://github.com/reactjs/redux/pull/1181#issuecomment-167361975). The UMD builds make Redux available as a `window.Redux` global variable. The Redux source code is written in ES2015 but we precompile both CommonJS and UMD builds to ES5 so they work in [any modern browser](http://caniuse.com/#feat=es5). You don't need to use Babel or a module bundler to [get started with Redux](https://github.com/reactjs/redux/blob/master/examples/counter-vanilla/index.html). #### Complementary Packages Most likely, you'll also need [the React bindings](https://github.com/reactjs/react-redux) and [the developer tools](https://github.com/gaearon/redux-devtools). ``` npm install --save react-redux npm install --save-dev redux-devtools ``` Note that unlike Redux itself, many packages in the Redux ecosystem don't provide UMD builds, so we recommend using CommonJS module bundlers like [Webpack](http://webpack.github.io) and [Browserify](http://browserify.org/) for the most comfortable development experience. ### The Gist The whole state of your app is stored in an object tree inside a single *store*. The only way to change the state tree is to emit an *action*, an object describing what happened. To specify how the actions transform the state tree, you write pure *reducers*. That's it! ```js import { createStore } from 'redux' /** * This is a reducer, a pure function with (state, action) => state signature. * It describes how an action transforms the state into the next state. * * The shape of the state is up to you: it can be a primitive, an array, an object, * or even an Immutable.js data structure. The only important part is that you should * not mutate the state object, but return a new object if the state changes. * * In this example, we use a `switch` statement and strings, but you can use a helper that * follows a different convention (such as function maps) if it makes sense for your * project. */ function counter(state = 0, action) { switch (action.type) { case 'INCREMENT': return state + 1 case 'DECREMENT': return state - 1 default: return state } } // Create a Redux store holding the state of your app. // Its API is { subscribe, dispatch, getState }. let store = createStore(counter) // You can use subscribe() to update the UI in response to state changes. // Normally you'd use a view binding library (e.g. React Redux) rather than subscribe() directly. // However it can also be handy to persist the current state in the localStorage. store.subscribe(() => console.log(store.getState()) ) // The only way to mutate the internal state is to dispatch an action. // The actions can be serialized, logged or stored and later replayed. store.dispatch({ type: 'INCREMENT' }) // 1 store.dispatch({ type: 'INCREMENT' }) // 2 store.dispatch({ type: 'DECREMENT' }) // 1 ``` Instead of mutating the state directly, you specify the mutations you want to happen with plain objects called *actions*. Then you write a special function called a *reducer* to decide how every action transforms the entire application's state. If you're coming from Flux, there is a single important difference you need to understand. Redux doesn't have a Dispatcher or support many stores. Instead, there is just a single store with a single root reducing function. As your app grows, instead of adding stores, you split the root reducer into smaller reducers independently operating on the different parts of the state tree. This is exactly like there is just one root component in a React app, but it is composed out of many small components. 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 t
100+评论
captcha