首页 星云 工具 资源 星选 资讯 热门工具
:

PDF转图片 完全免费 小红书视频下载 无水印 抖音视频下载 无水印 数字星空

redux-2.0.0.zip

前端 171.76KB 5 需要积分: 1
立即下载

资源介绍:

一个可预测的全局状态管理的 JS 库 A JS library for predictable global state management
# [Redux](http://rackt.github.io/redux) Redux is a predictable state container for JavaScript apps. 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) and has no dependencies. [![build status](https://img.shields.io/travis/rackt/redux/master.svg?style=flat-square)](https://travis-ci.org/rackt/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 slack](https://img.shields.io/badge/slack-redux@reactiflux-61DAFB.svg?style=flat-square)](http://www.reactiflux.com) ### 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, creator of Flux >[“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](https://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 takes a few minutes to get started with. ### Installation To install the stable version: ``` npm install --save redux ``` Most likely, you’ll also need [the React bindings](http://github.com/gaearon/react-redux) and [the developer tools](http://github.com/gaearon/redux-devtools). ``` npm install --save react-redux npm install --save-dev redux-devtools ``` This assumes that you’re using [npm](http://npmjs.com/) package manager with a module bundler like [Webpack](http://webpack.github.io) or [Browserify](http://browserify.org/) to consume [CommonJS modules](http://webpack.github.io/docs/commonjs.html). If you don’t yet use [npm](http://npmjs.com/) or a modern module bundler, and would rather prefer a single-file [UMD](https://github.com/umdjs/umd) build that makes `Redux` available as a global object, you can grab a pre-built version from [cdnjs](https://cdnjs.com/libraries/redux). We *don’t* recommend this approach for any serious application, as most of the libraries complementary to Redux are only available on [npm](http://npmjs.com/). ### 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 subscribe to the updates manually, or use bindings to your view layer. 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 to trace every mutation to the action that caused it. You can record user sessions and reproduce them just by replaying every action. ### Documentation * [Introduction](http://rackt.github.io/redux/docs/introduction/index.html) * [Basics](http://rackt.github.io/redux/docs/basics/index.html) * [Advanced](http://rackt.github.io/redux/docs/advanced/index.html) * [Recipes](http://rackt.github.io/redux/docs/recipes/index.html) * [Troubleshooting](http://rackt.github.io/redux/docs/Troubleshooting.html) * [Glossary](http://rackt.github.io/redux/docs/Glossary.html) * [API Reference](http://rackt.github.io/redux/docs/api/index.html) ### Examples * [Counter](http://rackt.github.io/redux/docs/introduction/Examples.html#counter) ([source](https://github.com/rackt/redux/tree/master/examples/counter)) * [TodoMVC](http://rackt.github.io/redux/docs/introduction/Examples.html#todomvc) ([source](https://github.com/rackt/redux/tree/master/examples/todomvc)) * [Async](http://rackt.github.io/redux/docs/introduction/Examples.html#async) ([source](https://github.com/rackt/redux/tree/master/examples/async)) * [Real World](http://rackt.github.io/redux/docs/introduction/Examples.html#real-world) ([source](https://github.com/rackt/redux/tree/master/examples/real-world)) If you’re new to the NPM ecosystem and have troubles getting a project up and running, or aren’t sure where to paste the gist above, check out [simplest-redux-example](https://github.com/jackielii/simplest-redux-example) that uses Redux together with React and Browserify. ### Discussion Join the **#redux** channel of the [Reactiflux](http://reactiflux.com) Slack community. ### Thanks * [The Elm Architecture](https://github.com/evancz/elm-architecture-tutorial) for a great intro to modeling state updates with reducers; * [Turning the database inside-out](http://blog.confluent.io/2015/03/04/turning-the-database-inside-out-with-apache-samza/) for blowing my mind; * [Developing ClojureScript with Figwheel](http://www.youtube.com/watch?v=j-kj2qwJ

资源文件列表:

redux-2.0.0.zip 大约有220个文件
  1. redux-2.0.0/
  2. redux-2.0.0/.babelrc 35B
  3. redux-2.0.0/.eslintignore 69B
  4. redux-2.0.0/.eslintrc 434B
  5. redux-2.0.0/.flowconfig 54B
  6. redux-2.0.0/.gitignore 53B
  7. redux-2.0.0/.npmignore 60B
  8. redux-2.0.0/.travis.yml 131B
  9. redux-2.0.0/CHANGELOG.md 18.94KB
  10. redux-2.0.0/CODE_OF_CONDUCT.md 1.39KB
  11. redux-2.0.0/LICENSE.md 1.05KB
  12. redux-2.0.0/PATRONS.md 639B
  13. redux-2.0.0/README.md 8.95KB
  14. redux-2.0.0/book.json 53B
  15. redux-2.0.0/docs/
  16. redux-2.0.0/docs/Glossary.md 8.09KB
  17. redux-2.0.0/docs/README.md 1.66KB
  18. redux-2.0.0/docs/Troubleshooting.md 6.05KB
  19. redux-2.0.0/docs/advanced/
  20. redux-2.0.0/docs/advanced/AsyncActions.md 19.67KB
  21. redux-2.0.0/docs/advanced/AsyncFlow.md 1.35KB
  22. redux-2.0.0/docs/advanced/ExampleRedditAPI.md 7.53KB
  23. redux-2.0.0/docs/advanced/Middleware.md 16.81KB
  24. redux-2.0.0/docs/advanced/NextSteps.md 103B
  25. redux-2.0.0/docs/advanced/README.md 421B
  26. redux-2.0.0/docs/advanced/UsageWithReactRouter.md 116B
  27. redux-2.0.0/docs/api/
  28. redux-2.0.0/docs/api/README.md 1.25KB
  29. redux-2.0.0/docs/api/Store.md 7.23KB
  30. redux-2.0.0/docs/api/applyMiddleware.md 9.71KB
  31. redux-2.0.0/docs/api/bindActionCreators.md 3.92KB
  32. redux-2.0.0/docs/api/combineReducers.md 4.15KB
  33. redux-2.0.0/docs/api/compose.md 2.1KB
  34. redux-2.0.0/docs/api/createStore.md 2.83KB
  35. redux-2.0.0/docs/basics/
  36. redux-2.0.0/docs/basics/Actions.md 4.57KB
  37. redux-2.0.0/docs/basics/DataFlow.md 4.83KB
  38. redux-2.0.0/docs/basics/ExampleTodoList.md 6.58KB
  39. redux-2.0.0/docs/basics/README.md 500B
  40. redux-2.0.0/docs/basics/Reducers.md 13.85KB
  41. redux-2.0.0/docs/basics/Store.md 2.92KB
  42. redux-2.0.0/docs/basics/UsageWithReact.md 11.93KB
  43. redux-2.0.0/docs/introduction/
  44. redux-2.0.0/docs/introduction/Ecosystem.md 2.77KB
  45. redux-2.0.0/docs/introduction/Examples.md 2.35KB
  46. redux-2.0.0/docs/introduction/Motivation.md 2.19KB
  47. redux-2.0.0/docs/introduction/PriorArt.md 7.18KB
  48. redux-2.0.0/docs/introduction/README.md 169B
  49. redux-2.0.0/docs/introduction/ThreePrinciples.md 2.94KB
  50. redux-2.0.0/docs/recipes/
  51. redux-2.0.0/docs/recipes/ComputingDerivedData.md 6.49KB
  52. redux-2.0.0/docs/recipes/MigratingToRedux.md 2.23KB
  53. redux-2.0.0/docs/recipes/README.md 440B
  54. redux-2.0.0/docs/recipes/ReducingBoilerplate.md 16.7KB
  55. redux-2.0.0/docs/recipes/ServerRendering.md 15.14KB
  56. redux-2.0.0/docs/recipes/WritingTests.md 10.83KB
  57. redux-2.0.0/examples/
  58. redux-2.0.0/examples/async/
  59. redux-2.0.0/examples/async/.babelrc 17B
  60. redux-2.0.0/examples/async/actions/
  61. redux-2.0.0/examples/async/actions/index.js 1.31KB
  62. redux-2.0.0/examples/async/components/
  63. redux-2.0.0/examples/async/components/Picker.js 672B
  64. redux-2.0.0/examples/async/components/Posts.js 317B
  65. redux-2.0.0/examples/async/containers/
  66. redux-2.0.0/examples/async/containers/App.js 2.56KB
  67. redux-2.0.0/examples/async/index.html 185B
  68. redux-2.0.0/examples/async/index.js 333B
  69. redux-2.0.0/examples/async/package.json 1015B
  70. redux-2.0.0/examples/async/reducers/
  71. redux-2.0.0/examples/async/reducers/index.js 1.22KB
  72. redux-2.0.0/examples/async/server.js 420B
  73. redux-2.0.0/examples/async/store/
  74. redux-2.0.0/examples/async/store/configureStore.js 667B
  75. redux-2.0.0/examples/async/webpack.config.js 1.12KB
  76. redux-2.0.0/examples/buildAll.js 1015B
  77. redux-2.0.0/examples/counter/
  78. redux-2.0.0/examples/counter/.babelrc 17B
  79. redux-2.0.0/examples/counter/actions/
  80. redux-2.0.0/examples/counter/actions/counter.js 599B
  81. redux-2.0.0/examples/counter/components/
  82. redux-2.0.0/examples/counter/components/Counter.js 822B
  83. redux-2.0.0/examples/counter/containers/
  84. redux-2.0.0/examples/counter/containers/App.js 431B
  85. redux-2.0.0/examples/counter/index.html 187B
  86. redux-2.0.0/examples/counter/index.js 303B
  87. redux-2.0.0/examples/counter/package.json 930B
  88. redux-2.0.0/examples/counter/reducers/
  89. redux-2.0.0/examples/counter/reducers/counter.js 285B
  90. redux-2.0.0/examples/counter/reducers/index.js 156B
  91. redux-2.0.0/examples/counter/server.js 420B
  92. redux-2.0.0/examples/counter/store/
  93. redux-2.0.0/examples/counter/store/configureStore.js 566B
  94. redux-2.0.0/examples/counter/test/
  95. redux-2.0.0/examples/counter/test/actions/
  96. redux-2.0.0/examples/counter/test/actions/counter.spec.js 1.35KB
  97. redux-2.0.0/examples/counter/test/components/
  98. redux-2.0.0/examples/counter/test/components/Counter.spec.js 1.68KB
  99. redux-2.0.0/examples/counter/test/containers/
  100. redux-2.0.0/examples/counter/test/containers/App.spec.js 1.79KB
  101. redux-2.0.0/examples/counter/test/jsdomReact.js 194B
  102. redux-2.0.0/examples/counter/test/reducers/
  103. redux-2.0.0/examples/counter/test/reducers/counter.spec.js 683B
  104. redux-2.0.0/examples/counter/webpack.config.js 1.12KB
  105. redux-2.0.0/examples/real-world/
  106. redux-2.0.0/examples/real-world/.babelrc 17B
  107. redux-2.0.0/examples/real-world/actions/
  108. redux-2.0.0/examples/real-world/actions/index.js 3.93KB
  109. redux-2.0.0/examples/real-world/components/
  110. redux-2.0.0/examples/real-world/components/Explore.js 1.48KB
  111. redux-2.0.0/examples/real-world/components/List.js 1.25KB
  112. redux-2.0.0/examples/real-world/components/Repo.js 812B
  113. redux-2.0.0/examples/real-world/components/User.js 639B
  114. redux-2.0.0/examples/real-world/containers/
  115. redux-2.0.0/examples/real-world/containers/App.js 1.86KB
  116. redux-2.0.0/examples/real-world/containers/RepoPage.js 2.43KB
  117. redux-2.0.0/examples/real-world/containers/UserPage.js 2.42KB
  118. redux-2.0.0/examples/real-world/index.html 190B
  119. redux-2.0.0/examples/real-world/index.js 827B
  120. redux-2.0.0/examples/real-world/middleware/
  121. redux-2.0.0/examples/real-world/middleware/api.js 3.44KB
  122. redux-2.0.0/examples/real-world/package.json 866B
  123. redux-2.0.0/examples/real-world/reducers/
  124. redux-2.0.0/examples/real-world/reducers/index.js 1.3KB
  125. redux-2.0.0/examples/real-world/reducers/paginate.js 1.71KB
  126. redux-2.0.0/examples/real-world/server.js 420B
  127. redux-2.0.0/examples/real-world/store/
  128. redux-2.0.0/examples/real-world/store/configureStore.js 731B
  129. redux-2.0.0/examples/real-world/webpack.config.js 1.12KB
  130. redux-2.0.0/examples/testAll.js 971B
  131. redux-2.0.0/examples/todomvc/
  132. redux-2.0.0/examples/todomvc/.babelrc 17B
  133. redux-2.0.0/examples/todomvc/actions/
  134. redux-2.0.0/examples/todomvc/actions/todos.js 527B
  135. redux-2.0.0/examples/todomvc/components/
  136. redux-2.0.0/examples/todomvc/components/Footer.js 1.78KB
  137. redux-2.0.0/examples/todomvc/components/Header.js 591B
  138. redux-2.0.0/examples/todomvc/components/MainSection.js 2.2KB
  139. redux-2.0.0/examples/todomvc/components/TodoItem.js 1.66KB
  140. redux-2.0.0/examples/todomvc/components/TodoTextInput.js 1.25KB
  141. redux-2.0.0/examples/todomvc/constants/
  142. redux-2.0.0/examples/todomvc/constants/ActionTypes.js 256B
  143. redux-2.0.0/examples/todomvc/constants/TodoFilters.js 126B
  144. redux-2.0.0/examples/todomvc/containers/
  145. redux-2.0.0/examples/todomvc/containers/App.js 805B
  146. redux-2.0.0/examples/todomvc/index.html 203B
  147. redux-2.0.0/examples/todomvc/index.js 370B
  148. redux-2.0.0/examples/todomvc/package.json 1021B
  149. redux-2.0.0/examples/todomvc/reducers/
  150. redux-2.0.0/examples/todomvc/reducers/index.js 150B
  151. redux-2.0.0/examples/todomvc/reducers/todos.js 1.14KB
  152. redux-2.0.0/examples/todomvc/server.js 420B
  153. redux-2.0.0/examples/todomvc/store/
  154. redux-2.0.0/examples/todomvc/store/configureStore.js 434B
  155. redux-2.0.0/examples/todomvc/test/
  156. redux-2.0.0/examples/todomvc/test/actions/
  157. redux-2.0.0/examples/todomvc/test/actions/todos.spec.js 1.18KB
  158. redux-2.0.0/examples/todomvc/test/components/
  159. redux-2.0.0/examples/todomvc/test/components/Footer.spec.js 3.35KB
  160. redux-2.0.0/examples/todomvc/test/components/Header.spec.js 1.41KB
  161. redux-2.0.0/examples/todomvc/test/components/MainSection.spec.js 4.38KB
  162. redux-2.0.0/examples/todomvc/test/components/TodoItem.spec.js 3.55KB
  163. redux-2.0.0/examples/todomvc/test/components/TodoTextItem.spec.js 2.62KB
  164. redux-2.0.0/examples/todomvc/test/jsdomReact.js 194B
  165. redux-2.0.0/examples/todomvc/test/reducers/
  166. redux-2.0.0/examples/todomvc/test/reducers/todos.spec.js 4.49KB
  167. redux-2.0.0/examples/todomvc/webpack.config.js 1.21KB
  168. redux-2.0.0/examples/universal/
  169. redux-2.0.0/examples/universal/.babelrc 17B
  170. redux-2.0.0/examples/universal/actions/
  171. redux-2.0.0/examples/universal/actions/counter.js 731B
  172. redux-2.0.0/examples/universal/api/
  173. redux-2.0.0/examples/universal/api/counter.js 450B
  174. redux-2.0.0/examples/universal/bin/
  175. redux-2.0.0/examples/universal/bin/server.js 49B
  176. redux-2.0.0/examples/universal/client.js 425B
  177. redux-2.0.0/examples/universal/components/
  178. redux-2.0.0/examples/universal/components/Counter.js 822B
  179. redux-2.0.0/examples/universal/containers/
  180. redux-2.0.0/examples/universal/containers/App.js 431B
  181. redux-2.0.0/examples/universal/index.js 24B
  182. redux-2.0.0/examples/universal/package.json 964B
  183. redux-2.0.0/examples/universal/reducers/
  184. redux-2.0.0/examples/universal/reducers/counter.js 345B
  185. redux-2.0.0/examples/universal/reducers/index.js 156B
  186. redux-2.0.0/examples/universal/server.js 1.87KB
  187. redux-2.0.0/examples/universal/store/
  188. redux-2.0.0/examples/universal/store/configureStore.js 582B
  189. redux-2.0.0/examples/universal/webpack.config.js 1.22KB
  190. redux-2.0.0/examples/universal/webpack.server.js 601B
  191. redux-2.0.0/package.json 2.56KB
  192. redux-2.0.0/src/
  193. redux-2.0.0/src/createStore.js 4.77KB
  194. redux-2.0.0/src/index.js 349B
  195. redux-2.0.0/src/utils/
  196. redux-2.0.0/src/utils/applyMiddleware.js 1.19KB
  197. redux-2.0.0/src/utils/bindActionCreators.js 1.71KB
  198. redux-2.0.0/src/utils/combineReducers.js 4.15KB
  199. redux-2.0.0/src/utils/compose.js 393B
  200. redux-2.0.0/src/utils/isPlainObject.js 627B
  201. redux-2.0.0/src/utils/mapValues.js 443B
  202. redux-2.0.0/src/utils/pick.js 470B
  203. redux-2.0.0/test/
  204. redux-2.0.0/test/createStore.spec.js 7.04KB
  205. redux-2.0.0/test/helpers/
  206. redux-2.0.0/test/helpers/actionCreators.js 643B
  207. redux-2.0.0/test/helpers/actionTypes.js 134B
  208. redux-2.0.0/test/helpers/middleware.js 167B
  209. redux-2.0.0/test/helpers/reducers.js 971B
  210. redux-2.0.0/test/utils/
  211. redux-2.0.0/test/utils/applyMiddleware.spec.js 2.22KB
  212. redux-2.0.0/test/utils/bindActionCreators.spec.js 2.16KB
  213. redux-2.0.0/test/utils/combineReducers.spec.js 5.15KB
  214. redux-2.0.0/test/utils/compose.spec.js 799B
  215. redux-2.0.0/test/utils/isPlainObject.spec.js 742B
  216. redux-2.0.0/test/utils/mapValues.spec.js 331B
  217. redux-2.0.0/test/utils/pick.spec.js 322B
  218. redux-2.0.0/webpack.config.base.js 295B
  219. redux-2.0.0/webpack.config.development.js 328B
  220. redux-2.0.0/webpack.config.production.js 442B
0评论
提交 加载更多评论
其他资源 redux-3.2.0.zip
一个可预测的全局状态管理的 JS 库 A JS library for predictable global state management
redux-3.4.0.zip
一个可预测的全局状态管理的 JS 库 A JS library for predictable global state management
redux-4.1.2.zip
一个可预测的全局状态管理的 JS 库 A JS library for predictable global state management
redux-thunk-2.0.0.zip
Redux 的 Thunk 中间件。它允许编写带有内部逻辑的函数,这些函数可以与 Redux 存储的 dispatch 和 getState 方法交互。
redux-0.2.2.zip
一个可预测的全局状态管理的 JS 库 A JS library for predictable global state management
redux-0.3.1.zip
一个可预测的全局状态管理的 JS 库 A JS library for predictable global state management
redux-0.5.0.zip
一个可预测的全局状态管理的 JS 库 A JS library for predictable global state management
redux-0.3.0.zip
一个可预测的全局状态管理的 JS 库 A JS library for predictable global state management