{"id":13396601,"url":"https://github.com/reduxjs/redux","last_synced_at":"2025-05-12T14:44:30.329Z","repository":{"id":32939128,"uuid":"36535156","full_name":"reduxjs/redux","owner":"reduxjs","description":"A JS library for predictable global state management","archived":false,"fork":false,"pushed_at":"2025-05-01T01:30:49.000Z","size":34110,"stargazers_count":61178,"open_issues_count":43,"forks_count":15242,"subscribers_count":1268,"default_branch":"master","last_synced_at":"2025-05-05T13:49:07.029Z","etag":null,"topics":["redux"],"latest_commit_sha":null,"homepage":"https://redux.js.org","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reduxjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE-logo.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["timdorr","markerikson","phryneas","EskiMojo14"]}},"created_at":"2015-05-29T23:53:15.000Z","updated_at":"2025-05-05T09:23:20.000Z","dependencies_parsed_at":"2023-12-30T03:19:48.648Z","dependency_job_id":"61ab9d7c-efe0-4766-b75c-a8b3883642ed","html_url":"https://github.com/reduxjs/redux","commit_stats":{"total_commits":3142,"total_committers":1032,"mean_commits":3.044573643410853,"dds":0.8033099936346276,"last_synced_commit":"41403bb2d8b67f799b8eafc164d51a789c05ebd8"},"previous_names":["reactjs/redux","rackt/redux","gaearon/redux"],"tags_count":88,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reduxjs%2Fredux","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reduxjs%2Fredux/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reduxjs%2Fredux/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reduxjs%2Fredux/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reduxjs","download_url":"https://codeload.github.com/reduxjs/redux/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253465865,"owners_count":21913057,"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":["redux"],"created_at":"2024-07-30T18:00:57.832Z","updated_at":"2025-05-12T14:44:30.295Z","avatar_url":"https://github.com/reduxjs.png","language":"TypeScript","funding_links":["https://github.com/sponsors/timdorr","https://github.com/sponsors/markerikson","https://github.com/sponsors/phryneas","https://github.com/sponsors/EskiMojo14"],"categories":["react","HarmonyOS","State Management","TypeScript","Utilities","cross framework","Frontend React","前端相关","GraphQL Tool, Libraries, and Frameworks","Tools","**🏎 Core technologies**","[TypeScript](#typescript)","React Tools and Frameworks","前端开发框架及项目","Explanation of each State Management","\u003e 30k ★","数据流","Uncategorized","redux",":atom_symbol: Redux","Web Development","Веб-разработка","JavaScript Tools, Libraries, and Frameworks","React","⚛️ React","📖 Categories","武器库","Repository app","Redux [🔝](#readme)","Programming technologies","🔧 Utilities \u0026 Miscellaneous","目录"],"sub_categories":["Windows Manager","State Management","Client-State management","其他_文本生成、文本对话","Redux","macros","Uncategorized","Redux General Resources","Objective-C Tools, Libraries, and Frameworks","Mesh networks","State management","前端","Libraries","\u003ca id=\"state\"\u003e状态管理\u003c/a\u003e"],"readme":"# \u003ca href='https://redux.js.org'\u003e\u003cimg src='https://avatars.githubusercontent.com/u/13142323?s=200\u0026v=4' height='60' alt='Redux Logo' aria-label='redux.js.org' style=\"display: flex;align-items: center;\"/\u003eRedux\u003c/a\u003e\n\nRedux is a JS library for predictable and maintainable global state management.\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/reduxjs/redux-devtools).\n\nYou can use Redux together with [React](https://react.dev), or with any other view library. The Redux core is tiny (2kB, including dependencies), and has a rich ecosystem of addons.\n\n[**Redux Toolkit**](https://redux-toolkit.js.org) is our official recommended approach for writing Redux logic. It wraps around the Redux core, and contains packages and functions that we think are essential for building a Redux app. Redux Toolkit builds in our suggested best practices, simplifies most Redux tasks, prevents common mistakes, and makes it easier to write Redux applications.\n\n![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/reduxjs/redux/test.yaml?branch=master\u0026event=push\u0026style=flat-square)\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\n## Installation\n\n### Create a React Redux App\n\nThe recommended way to start new apps with React and Redux Toolkit is by using [our official Redux Toolkit + TS template for Vite](https://github.com/reduxjs/redux-templates), or by creating a new Next.js project using [Next's `with-redux` template](https://github.com/vercel/next.js/tree/canary/examples/with-redux).\n\nBoth of these already have Redux Toolkit and React-Redux configured appropriately for that build tool, and come with a small example app that demonstrates how to use several of Redux Toolkit's features.\n\n```bash\n# Vite with our Redux+TS template\n# (using the `degit` tool to clone and extract the template)\nnpx degit reduxjs/redux-templates/packages/vite-template-redux my-app\n\n# Next.js using the `with-redux` template\nnpx create-next-app --example with-redux my-app\n```\n\nWe do not currently have official React Native templates, but recommend these templates for standard React Native and for Expo:\n\n- https://github.com/rahsheen/react-native-template-redux-typescript\n- https://github.com/rahsheen/expo-template-redux-typescript\n\n```\nnpm install @reduxjs/toolkit react-redux\n```\n\nFor the Redux core library by itself:\n\n```\nnpm install redux\n```\n\nFor more details, see [the Installation docs page](https://redux.js.org/introduction/installation).\n\n## Documentation\n\nThe Redux core docs are located at **https://redux.js.org**, and include the full Redux tutorials, as well usage guides on general Redux patterns:\n\n- [Introduction](https://redux.js.org/introduction/getting-started)\n- [Tutorials](https://redux.js.org/tutorials/index)\n- [Usage Guides](https://redux.js.org/usage/index)\n- [FAQ](https://redux.js.org/faq)\n- [API Reference](https://redux.js.org/api/api-reference)\n\nThe Redux Toolkit docs are available at **https://redux-toolkit.js.org**, including API references and usage guides for all of the APIs included in Redux Toolkit.\n\n## Learn Redux\n\n### Redux Essentials Tutorial\n\nThe [**Redux Essentials tutorial**](https://redux.js.org/tutorials/essentials/part-1-overview-concepts) is a \"top-down\" tutorial that teaches \"how to use Redux the right way\", using our latest recommended APIs and best practices. We recommend starting there.\n\n### Redux Fundamentals Tutorial\n\nThe [**Redux Fundamentals tutorial**](https://redux.js.org/tutorials/fundamentals/part-1-overview) is a \"bottom-up\" tutorial that teaches \"how Redux works\" from first principles and without any abstractions, and why standard Redux usage patterns exist.\n\n### Help and Discussion\n\nThe **[#redux channel](https://discord.gg/0ZcbPKXt5bZ6au5t)** of the **[Reactiflux Discord community](https://www.reactiflux.com)** is our official resource for all questions related to learning and using Redux. Reactiflux is a great place to hang out, ask questions, and learn - please come and join us there!\n\n## Before Proceeding Further\n\nRedux is a valuable tool for organizing your state, but you should also consider whether it's appropriate for your situation. Please don't use Redux just because someone said you should - instead, please take some time to understand the potential benefits and tradeoffs of using it.\n\nHere are some suggestions on when it makes sense to use Redux:\n\n- You have reasonable amounts of data changing over time\n- You need a single source of truth for your state\n- You find that keeping all your state in a top-level component is no longer sufficient\n\nYes, these guidelines are subjective and vague, but this is for a good reason. The point at which you should integrate Redux into your application is different for every user and different for every application.\n\n\u003e **For more thoughts on how Redux is meant to be used, please see:**\u003cbr\u003e\n\u003e\n\u003e - **[When (and when not) to reach for Redux](https://changelog.com/posts/when-and-when-not-to-reach-for-redux)**\n\u003e - **[You Might Not Need Redux](https://medium.com/@dan_abramov/you-might-not-need-redux-be46360cf367)**\u003cbr\u003e\n\u003e - **[The Tao of Redux, Part 1 - Implementation and Intent](https://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao-of-redux-part-1/)**\u003cbr\u003e\n\u003e - **[The Tao of Redux, Part 2 - Practice and Philosophy](https://blog.isquaredsoftware.com/2017/05/idiomatic-redux-tao-of-redux-part-2/)**\n\u003e - **[Redux FAQ](https://redux.js.org/faq)**\n\n## Basic Example\n\nThe whole global state of your app is stored in an object tree inside a single _store_.\nThe only way to change the state tree is to create an _action_, an object describing what happened, and _dispatch_ it to the store.\nTo specify how state gets updated in response to an action, you write pure _reducer_ functions that calculate a new state based on the old state and the action.\n\nRedux Toolkit simplifies the process of writing Redux logic and setting up the store. With Redux Toolkit, the basic app logic looks like:\n\n```js\nimport { createSlice, configureStore } from '@reduxjs/toolkit'\n\nconst counterSlice = createSlice({\n  name: 'counter',\n  initialState: {\n    value: 0\n  },\n  reducers: {\n    incremented: state =\u003e {\n      // Redux Toolkit allows us to write \"mutating\" logic in reducers. It\n      // doesn't actually mutate the state because it uses the Immer library,\n      // which detects changes to a \"draft state\" and produces a brand new\n      // immutable state based off those changes\n      state.value += 1\n    },\n    decremented: state =\u003e {\n      state.value -= 1\n    }\n  }\n})\n\nexport const { incremented, decremented } = counterSlice.actions\n\nconst store = configureStore({\n  reducer: counterSlice.reducer\n})\n\n// Can still subscribe to the store\nstore.subscribe(() =\u003e console.log(store.getState()))\n\n// Still pass action objects to `dispatch`, but they're created for us\nstore.dispatch(incremented())\n// {value: 1}\nstore.dispatch(incremented())\n// {value: 2}\nstore.dispatch(decremented())\n// {value: 1}\n```\n\nRedux Toolkit allows us to write shorter logic that's easier to read, while still following the original core Redux behavior and data flow.\n\n## Logo\n\nYou can find the official logo [on GitHub](https://github.com/reduxjs/redux/tree/master/logo).\n\n## Change Log\n\nThis project adheres to [Semantic Versioning](https://semver.org/).\nEvery release, along with the migration instructions, is documented on the GitHub [Releases](https://github.com/reduxjs/redux/releases) page.\n\n## License\n\n[MIT](LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freduxjs%2Fredux","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freduxjs%2Fredux","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freduxjs%2Fredux/lists"}