{"id":15285960,"url":"https://github.com/plotly/redux","last_synced_at":"2025-10-07T01:30:27.614Z","repository":{"id":57326027,"uuid":"52470223","full_name":"plotly/redux","owner":"plotly","description":"Predictable state container for JavaScript apps","archived":false,"fork":true,"pushed_at":"2016-02-24T20:29:00.000Z","size":2875,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-05-12T00:40:19.382Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://redux.js.org","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"reduxjs/redux","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plotly.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-24T19:54:50.000Z","updated_at":"2018-05-12T19:45:59.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/plotly/redux","commit_stats":null,"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotly%2Fredux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotly%2Fredux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotly%2Fredux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plotly%2Fredux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plotly","download_url":"https://codeload.github.com/plotly/redux/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235569499,"owners_count":19011184,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-30T15:08:48.881Z","updated_at":"2025-10-07T01:30:27.152Z","avatar_url":"https://github.com/plotly.png","language":"JavaScript","funding_links":["https://www.patreon.com/reactdx"],"categories":[],"sub_categories":[],"readme":"# [Redux](http://redux.js.org)\n\nRedux is a predictable state container for JavaScript apps.  \n\nIt 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).\n\nYou can use Redux together with [React](https://facebook.github.io/react/), or with any other view library.  \nIt is tiny (2kB, including dependencies).\n\n[![build status](https://img.shields.io/travis/reactjs/redux/master.svg?style=flat-square)](https://travis-ci.org/reactjs/redux)\n[![npm version](https://img.shields.io/npm/v/redux.svg?style=flat-square)](https://www.npmjs.com/package/redux)\n[![npm downloads](https://img.shields.io/npm/dm/redux.svg?style=flat-square)](https://www.npmjs.com/package/redux)\n[![redux channel on discord](https://img.shields.io/badge/discord-%23redux%20%40%20reactiflux-61dafb.svg?style=flat-square)](https://discord.gg/0ZcbPKXt5bZ6au5t)\n[![#rackt on freenode](https://img.shields.io/badge/irc-%23rackt%20%40%20freenode-61DAFB.svg?style=flat-square)](https://webchat.freenode.net/)\n[![Changelog #187](https://img.shields.io/badge/changelog-%23187-lightgrey.svg?style=flat-square)](https://changelog.com/187)\n\n\u003e**New! Learn Redux from its creator:  \n\u003e[Getting Started with Redux](https://egghead.io/series/getting-started-with-redux) (30 free videos)**\n\n### Testimonials\n\n\u003e[“Love what you’re doing with Redux”](https://twitter.com/jingc/status/616608251463909376)  \n\u003eJing Chen, creator of Flux\n\n\u003e[“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)  \n\u003eBill Fisher, author of Flux documentation\n\n\u003e[“It's cool that you are inventing a better Flux by not doing Flux at all.”](https://twitter.com/andrestaltz/status/616271392930201604)  \n\u003eAndré Staltz, creator of Cycle\n\n### Developer Experience\n\nI 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.\n\n### Influences\n\nRedux 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/).  \nWhether you have used them or not, Redux only takes a few minutes to get started with.\n\n### Installation\n\nTo install the stable version:\n\n```\nnpm install --save redux\n```\n\nMost likely, you’ll also need [the React bindings](https://github.com/reactjs/react-redux) and [the developer tools](https://github.com/gaearon/redux-devtools).\n\n```\nnpm install --save react-redux\nnpm install --save-dev redux-devtools\n```\n\nThis assumes that you’re using [npm](https://www.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).\n\nIf you don’t yet use [npm](https://www.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](https://www.npmjs.com/).\n\n### The Gist\n\nThe whole state of your app is stored in an object tree inside a single *store*.  \nThe only way to change the state tree is to emit an *action*, an object describing what happened.  \nTo specify how the actions transform the state tree, you write pure *reducers*.\n\nThat’s it!\n\n```js\nimport { createStore } from 'redux'\n\n/**\n * This is a reducer, a pure function with (state, action) =\u003e state signature.\n * It describes how an action transforms the state into the next state.\n *\n * The shape of the state is up to you: it can be a primitive, an array, an object,\n * or even an Immutable.js data structure. The only important part is that you should\n * not mutate the state object, but return a new object if the state changes.\n *\n * In this example, we use a `switch` statement and strings, but you can use a helper that\n * follows a different convention (such as function maps) if it makes sense for your project.\n */\nfunction counter(state = 0, action) {\n  switch (action.type) {\n  case 'INCREMENT':\n    return state + 1\n  case 'DECREMENT':\n    return state - 1\n  default:\n    return state\n  }\n}\n\n// Create a Redux store holding the state of your app.\n// Its API is { subscribe, dispatch, getState }.\nlet store = createStore(counter)\n\n// You can subscribe to the updates manually, or use bindings to your view layer.\nstore.subscribe(() =\u003e\n  console.log(store.getState())\n)\n\n// The only way to mutate the internal state is to dispatch an action.\n// The actions can be serialized, logged or stored and later replayed.\nstore.dispatch({ type: 'INCREMENT' })\n// 1\nstore.dispatch({ type: 'INCREMENT' })\n// 2\nstore.dispatch({ type: 'DECREMENT' })\n// 1\n```\n\nInstead 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.\n\nIf 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.\n\nThis 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.\n\n### Learn Redux from Its Creator\n\n[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.**\n\n\u003e[“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)  \n\u003eSandrino Di Mattia\n\n\u003e[“Plowing through @dan_abramov 'Getting Started with Redux' - its amazing how much simpler concepts get with video.”](https://twitter.com/chrisdhanaraj/status/670328025553219584)  \n\u003eChris Dhanaraj\n\n\u003e[“This video series on Redux by @dan_abramov on @eggheadio is spectacular!”](https://twitter.com/eddiezane/status/670333133242408960)  \n\u003eEddie Zaneski\n\n\u003e[“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)  \n\u003eDan\n\n\u003e[“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)  \n\u003eLaurence Roberts\n\nSo, what are you waiting for?\n\n#### [Watch the 30 Free Videos!](https://egghead.io/series/getting-started-with-redux)\n\nIf 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.\n\n### Documentation\n\n* [Introduction](http://redux.js.org/docs/introduction/index.html)\n* [Basics](http://redux.js.org/docs/basics/index.html)\n* [Advanced](http://redux.js.org/docs/advanced/index.html)\n* [Recipes](http://redux.js.org/docs/recipes/index.html)\n* [Troubleshooting](http://redux.js.org/docs/Troubleshooting.html)\n* [Glossary](http://redux.js.org/docs/Glossary.html)\n* [API Reference](http://redux.js.org/docs/api/index.html)\n\nFor PDF, ePub, and MOBI exports for offline reading, and instructions on how to create them, please see: [paulkogel/redux-offline-docs](https://github.com/paulkogel/redux-offline-docs).\n\n### Examples\n\n* [Counter Vanilla](http://redux.js.org/docs/introduction/Examples.html#counter-vanilla) ([source](https://github.com/reactjs/redux/tree/master/examples/counter-vanilla))\n* [Counter](http://redux.js.org/docs/introduction/Examples.html#counter) ([source](https://github.com/reactjs/redux/tree/master/examples/counter))\n* [Todos](http://redux.js.org/docs/introduction/Examples.html#todos) ([source](https://github.com/reactjs/redux/tree/master/examples/todos))\n* [Todos with Undo](http://redux.js.org/docs/introduction/Examples.html#todos-with-undo) ([source](https://github.com/reactjs/redux/tree/master/examples/todos-with-undo))\n* [TodoMVC](http://redux.js.org/docs/introduction/Examples.html#todomvc) ([source](https://github.com/reactjs/redux/tree/master/examples/todomvc))\n* [Shopping Cart](http://redux.js.org/docs/introduction/Examples.html#shopping-cart) ([source](https://github.com/reactjs/redux/tree/master/examples/shopping-cart))\n* [Tree View](http://redux.js.org/docs/introduction/Examples.html#tree-view) ([source](https://github.com/reactjs/redux/tree/master/examples/tree-view))\n* [Async](http://redux.js.org/docs/introduction/Examples.html#async) ([source](https://github.com/reactjs/redux/tree/master/examples/async))\n* [Universal](http://redux.js.org/docs/introduction/Examples.html#universal) ([source](https://github.com/reactjs/redux/tree/master/examples/universal))\n* [Real World](http://redux.js.org/docs/introduction/Examples.html#real-world) ([source](https://github.com/reactjs/redux/tree/master/examples/real-world))\n\nIf 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.\n\n### Discussion\n\nJoin the [#redux](https://discord.gg/0ZcbPKXt5bZ6au5t) channel of the [Reactiflux](http://www.reactiflux.com) Discord community.\n\n### Thanks\n\n* [The Elm Architecture](https://github.com/evancz/elm-architecture-tutorial) for a great intro to modeling state updates with reducers;\n* [Turning the database inside-out](http://www.confluent.io/blog/turning-the-database-inside-out-with-apache-samza/) for blowing my mind;\n* [Developing ClojureScript with Figwheel](https://www.youtube.com/watch?v=j-kj2qwJa_E) for convincing me that re-evaluation should “just work”;\n* [Webpack](https://github.com/webpack/docs/wiki/hot-module-replacement-with-webpack) for Hot Module Replacement;\n* [Flummox](https://github.com/acdlite/flummox) for teaching me to approach Flux without boilerplate or singletons;\n* [disto](https://github.com/threepointone/disto) for a proof of concept of hot reloadable Stores;\n* [NuclearJS](https://github.com/optimizely/nuclear-js) for proving this architecture can be performant;\n* [Om](https://github.com/omcljs/om) for popularizing the idea of a single state atom;\n* [Cycle](https://github.com/cyclejs/cycle-core) for showing how often a function is the best tool;\n* [React](https://github.com/facebook/react) for the pragmatic innovation.\n\nSpecial thanks to [Jamie Paton](http://jdpaton.github.io) for handing over the `redux` NPM package name.\n\n### Change Log\n\nThis project adheres to [Semantic Versioning](http://semver.org/).  \nEvery release, along with the migration instructions, is documented on the Github [Releases](https://github.com/reactjs/redux/releases) page.\n\n### Patrons\n\nThe work on Redux was [funded by the community](https://www.patreon.com/reactdx).  \nMeet some of the outstanding companies that made it possible:\n\n* [Webflow](https://github.com/webflow)\n* [Ximedes](https://www.ximedes.com/)\n\n[See the full list of Redux patrons.](PATRONS.md)\n\n### License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplotly%2Fredux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplotly%2Fredux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplotly%2Fredux/lists"}