Skip to content

Commit 2e25c1f

Browse files
committed
add note about only calling methods once
1 parent 90555ee commit 2e25c1f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/toolkit/src/createSlice.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,9 @@ export interface ReducerHandlingContext<State> {
227227
): ReducerHandlingContext<State>
228228
/**
229229
* Add an action to be exposed under the final `slice.actions[reducerName]` key.
230+
*
231+
* Should only be called once per handler.
232+
*
230233
* @param actionCreator The action to expose.
231234
* @example
232235
* context.exposeAction(createAction<Post>(type));
@@ -238,6 +241,9 @@ export interface ReducerHandlingContext<State> {
238241
exposeAction(actionCreator: unknown): ReducerHandlingContext<State>
239242
/**
240243
* Add a case reducer to be exposed under the final `slice.caseReducers[reducerName]` key.
244+
*
245+
* Should only be called once per handler.
246+
*
241247
* @param reducer The reducer to expose.
242248
* @example
243249
* context.exposeCaseReducer((state, action: PayloadAction<Post>) => {

0 commit comments

Comments
 (0)