[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-70702":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":16,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":20,"hasPages":20,"topics":22,"createdAt":10,"pushedAt":10,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":16,"starSnapshotCount":16,"syncStatus":26,"lastSyncTime":27,"discoverSource":28},70702,"redux-toolkit","reduxjs\u002Fredux-toolkit","reduxjs","The official, opinionated, batteries-included toolset for efficient Redux development","https:\u002F\u002Fredux-toolkit.js.org",null,"TypeScript",11216,1266,70,218,0,10,70.31,"MIT License",false,"master",[],"2026-06-12 04:00:56","# Redux Toolkit\n\n![GitHub Workflow Status](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Factions\u002Fworkflow\u002Fstatus\u002Freduxjs\u002Fredux-toolkit\u002Ftests.yml?style=flat-square)\n[![npm version](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002F@reduxjs\u002Ftoolkit.svg?style=flat-square)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@reduxjs\u002Ftoolkit)\n[![npm downloads](https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fdm\u002F@reduxjs\u002Ftoolkit.svg?style=flat-square&label=RTK+downloads)](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@reduxjs\u002Ftoolkit)\n\n**The official, opinionated, batteries-included toolset for efficient Redux development**\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:\u002F\u002Fgithub.com\u002Freduxjs\u002Fredux-templates), or by creating a new Next.js project using [Next's `with-redux` template](https:\u002F\u002Fgithub.com\u002Fvercel\u002Fnext.js\u002Ftree\u002Fcanary\u002Fexamples\u002Fwith-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\u002Fredux-templates\u002Fpackages\u002Fvite-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:\u002F\u002Fgithub.com\u002Frahsheen\u002Freact-native-template-redux-typescript\n- https:\u002F\u002Fgithub.com\u002Frahsheen\u002Fexpo-template-redux-typescript\n\n### An Existing App\n\nRedux Toolkit is available as a package on NPM for use with a module bundler or in a Node application:\n\n```bash\n# NPM\nnpm install @reduxjs\u002Ftoolkit\n\n# Yarn\nyarn add @reduxjs\u002Ftoolkit\n```\n\nIf you use an AI agent, run `npx @tanstack\u002Fintent@latest install` to install agent skills.\n\nThe package includes a precompiled ESM build that can be used as a [`\u003Cscript type=\"module\">` tag](https:\u002F\u002Funpkg.com\u002F@reduxjs\u002Ftoolkit\u002Fdist\u002Fredux-toolkit.browser.mjs) directly in the browser.\n\n## Documentation\n\nThe Redux Toolkit docs are available at **https:\u002F\u002Fredux-toolkit.js.org**, including API references and usage guides for all of the APIs included in Redux Toolkit.\n\nThe Redux core docs at https:\u002F\u002Fredux.js.org includes the full Redux tutorials, as well usage guides on general Redux patterns.\n\n## Purpose\n\nThe **Redux Toolkit** package is intended to be the standard way to write Redux logic. It was originally created to help address three common concerns about Redux:\n\n- \"Configuring a Redux store is too complicated\"\n- \"I have to add a lot of packages to get Redux to do anything useful\"\n- \"Redux requires too much boilerplate code\"\n\nWe can't solve every use case, but in the spirit of [`create-react-app`](https:\u002F\u002Fgithub.com\u002Ffacebook\u002Fcreate-react-app), we can try to provide some tools that abstract over the setup process and handle the most common use cases, as well as include some useful utilities that will let the user simplify their application code.\n\nBecause of that, this package is deliberately limited in scope. It does _not_ address concepts like \"reusable encapsulated Redux modules\", folder or file structures, managing entity relationships in the store, and so on.\n\nRedux Toolkit also includes a powerful data fetching and caching capability that we've dubbed \"RTK Query\". It's included in the package as a separate set of entry points. It's optional, but can eliminate the need to hand-write data fetching logic yourself.\n\n## What's Included\n\nRedux Toolkit includes these APIs:\n\n- `configureStore()`: wraps `createStore` to provide simplified configuration options and good defaults. It can automatically combine your slice reducers, add whatever Redux middleware you supply, includes `redux-thunk` by default, and enables use of the Redux DevTools Extension.\n- `createReducer()`: lets you supply a lookup table of action types to case reducer functions, rather than writing switch statements. In addition, it automatically uses the [`immer` library](https:\u002F\u002Fgithub.com\u002Fmweststrate\u002Fimmer) to let you write simpler immutable updates with normal mutative code, like `state.todos[3].completed = true`.\n- `createAction()`: generates an action creator function for the given action type string. The function itself has `toString()` defined, so that it can be used in place of the type constant.\n- `createSlice()`: combines `createReducer()` + `createAction()`. Accepts an object of reducer functions, a slice name, and an initial state value, and automatically generates a slice reducer with corresponding action creators and action types.\n- `combineSlices()`: combines multiple slices into a single reducer, and allows \"lazy loading\" of slices after initialisation.\n- `createListenerMiddleware()`: lets you define \"listener\" entries that contain an \"effect\" callback with additional logic, and a way to specify when that callback should run based on dispatched actions or state changes. A lightweight alternative to Redux async middleware like sagas and observables.\n- `createAsyncThunk()`: accepts an action type string and a function that returns a promise, and generates a thunk that dispatches `pending\u002Fresolved\u002Frejected` action types based on that promise\n- `createEntityAdapter()`: generates a set of reusable reducers and selectors to manage normalized data in the store\n- The `createSelector()` utility from the [Reselect](https:\u002F\u002Fgithub.com\u002Freduxjs\u002Freselect) library, re-exported for ease of use.\n\nFor details, see [the Redux Toolkit API Reference section in the docs](https:\u002F\u002Fredux-toolkit.js.org\u002Fapi\u002FconfigureStore).\n\n## RTK Query\n\n**RTK Query** is provided as an optional addon within the `@reduxjs\u002Ftoolkit` package. It is purpose-built to solve the use case of data fetching and caching, supplying a compact, but powerful toolset to define an API interface layer for your app. It is intended to simplify common cases for loading data in a web application, eliminating the need to hand-write data fetching & caching logic yourself.\n\nRTK Query is built on top of the Redux Toolkit core for its implementation, using [Redux](https:\u002F\u002Fredux.js.org\u002F) internally for its architecture. Although knowledge of Redux and RTK are not required to use RTK Query, you should explore all of the additional global store management capabilities they provide, as well as installing the [Redux DevTools browser extension](https:\u002F\u002Fgithub.com\u002Freduxjs\u002Fredux-devtools), which works flawlessly with RTK Query to traverse and replay a timeline of your request & cache behavior.\n\nRTK Query is included within the installation of the core Redux Toolkit package. It is available via either of the two entry points below:\n\n```ts no-transpile\nimport { createApi } from '@reduxjs\u002Ftoolkit\u002Fquery'\n\n\u002F* React-specific entry point that automatically generates\n   hooks corresponding to the defined endpoints *\u002F\nimport { createApi } from '@reduxjs\u002Ftoolkit\u002Fquery\u002Freact'\n```\n\n### What's included\n\nRTK Query includes these APIs:\n\n- `createApi()`: The core of RTK Query's functionality. It allows you to define a set of endpoints describe how to retrieve data from a series of endpoints, including configuration of how to fetch and transform that data. In most cases, you should use this once per app, with \"one API slice per base URL\" as a rule of thumb.\n- `fetchBaseQuery()`: A small wrapper around fetch that aims to simplify requests. Intended as the recommended baseQuery to be used in createApi for the majority of users.\n- `\u003CApiProvider \u002F>`: Can be used as a Provider if you do not already have a Redux store.\n- `setupListeners()`: A utility used to enable refetchOnMount and refetchOnReconnect behaviors.\n\nSee the [**RTK Query Overview**](https:\u002F\u002Fredux-toolkit.js.org\u002Frtk-query\u002Foverview) page for more details on what RTK Query is, what problems it solves, and how to use it.\n\n## Contributing\n\nPlease refer to our [contributing guide](\u002FCONTRIBUTING.md) to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to Redux Toolkit.\n","Redux Toolkit 是官方推荐的一套高效开发 Redux 应用的工具集。它提供了包括配置存储、创建 reducer 和 action 生成器在内的多项核心功能，旨在简化 Redux 的设置过程并减少冗余代码。基于 TypeScript 开发，确保了类型安全与更好的开发者体验。适用于需要快速搭建或优化现有 Redux 架构的应用场景，尤其是当项目希望遵循最佳实践同时保持简洁时。无论是新建 React 或 Next.js 项目还是改进已有应用，Redux Toolkit 都能提供强大支持。",2,"2026-06-11 03:33:43","high_star"]