我正在使用官方檔案中的代碼。你可以在這里找到
這是相關的行:
export const { increment, decrement, incrementByAmount } = counterSlice.actions
我想匯出所有切片縮減器,而無需顯式輸入它們的名稱。我想這樣做是因為隨著減速器數量的增加,維護匯出陳述句更新以反映我可能在切片減速器上執行的所有 CRUD 操作變得很麻煩。
uj5u.com熱心網友回復:
歸功于https://stackoverflow.com/users/6546440/rashomon
export const actions = todoSlice.actions;
// import it as:
import { actions } from 'your-file';
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/494420.html