redux-toolkit by mindrally/skills
npx skills add https://github.com/mindrally/skills --skill redux-toolkit您是 React 和 Next.js 应用程序中状态管理方面的 Redux Toolkit 专家。
createSlice 来统一定义状态、reducer 和 actionimport { createSlice, PayloadAction } from '@reduxjs/toolkit'
interface CounterState {
value: number
isLoading: boolean
}
const initialState: CounterState = {
value: 0,
isLoading: false,
}
const counterSlice = createSlice({
name: 'counter',
initialState,
reducers: {
increment: (state) => {
state.value += 1
},
setLoading: (state, action: PayloadAction<boolean>) => {
state.isLoading = action.payload
},
},
})
export const { increment, setLoading } = counterSlice.actions
export default counterSlice.reducer
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
handle(例如:handleClick)isLoading,hasError)use(例如:useAuth)useAppDispatch,useAppSelector)export const fetchUser = createAsyncThunk(
'user/fetch',
async (userId: string, { rejectWithValue }) => {
try {
const response = await api.getUser(userId)
return response.data
} catch (error) {
return rejectWithValue(error.message)
}
}
)
React.memo()useCallback 记忆化函数useMemocreateSelector 创建记忆化的 selector每周安装量
307
代码仓库
GitHub 星标数
43
首次出现
2026年1月25日
安全审计
安装于
opencode262
gemini-cli254
codex249
github-copilot247
cursor229
kimi-cli212
You are an expert in Redux Toolkit for state management in React and Next.js applications.
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
interface CounterState {
value: number
isLoading: boolean
}
const initialState: CounterState = {
value: 0,
isLoading: false,
}
const counterSlice = createSlice({
name: 'counter',
initialState,
reducers: {
increment: (state) => {
state.value += 1
},
setLoading: (state, action: PayloadAction<boolean>) => {
state.isLoading = action.payload
},
},
})
export const { increment, setLoading } = counterSlice.actions
export default counterSlice.reducer
handle (e.g., handleClick)isLoading, hasError)use (e.g., useAuth)useAppDispatch, useAppSelector)export const fetchUser = createAsyncThunk(
'user/fetch',
async (userId: string, { rejectWithValue }) => {
try {
const response = await api.getUser(userId)
return response.data
} catch (error) {
return rejectWithValue(error.message)
}
}
)
Weekly Installs
307
Repository
GitHub Stars
43
First Seen
Jan 25, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode262
gemini-cli254
codex249
github-copilot247
cursor229
kimi-cli212
GSAP时间轴动画教程:创建多步骤序列动画与关键帧控制
1,400 周安装