Skip to content

Commit cefc43d

Browse files
committed
docs: Remove references to wrapped reducer function
Changing reducers to be directly exported. Issue: #3192
1 parent a6fe92d commit cefc43d

File tree

2 files changed

+3
-13
lines changed

2 files changed

+3
-13
lines changed

projects/ngrx.io/content/guide/entity/adapter.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,7 @@ export const initialState: State = adapter.getInitialState({
7070
selectedUserId: null,
7171
});
7272

73-
const userReducer = createReducer(initialState);
74-
75-
export function reducer(state: State | undefined, action: Action) {
76-
return userReducer(state, action);
77-
}
73+
export const userReducer = createReducer(initialState);
7874
</code-example>
7975

8076
## Adapter Collection Methods
@@ -149,7 +145,7 @@ export const initialState: State = adapter.getInitialState({
149145
selectedUserId: null,
150146
});
151147

152-
const userReducer = createReducer(
148+
export const userReducer = createReducer(
153149
initialState,
154150
on(UserActions.addUser, (state, { user }) => {
155151
return adapter.addOne(user, state)
@@ -198,9 +194,6 @@ const userReducer = createReducer(
198194
})
199195
);
200196

201-
export function reducer(state: State | undefined, action: Action) {
202-
return userReducer(state, action);
203-
}
204197

205198
export const getSelectedUserId = (state: State) => state.selectedUserId;
206199

projects/ngrx.io/content/guide/store/reducers.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,14 @@ The initial values for the `home` and `away` properties of the state are 0.
6969
The reducer function's responsibility is to handle the state transitions in an immutable way. Create a reducer function that handles the actions for managing the state of the scoreboard using the `createReducer` function.
7070

7171
<code-example header="scoreboard.reducer.ts">
72-
const scoreboardReducer = createReducer(
72+
export const scoreboardReducer = createReducer(
7373
initialState,
7474
on(ScoreboardPageActions.homeScore, state => ({ ...state, home: state.home + 1 })),
7575
on(ScoreboardPageActions.awayScore, state => ({ ...state, away: state.away + 1 })),
7676
on(ScoreboardPageActions.resetScore, state => ({ home: 0, away: 0 })),
7777
on(ScoreboardPageActions.setScores, (state, { game }) => ({ home: game.home, away: game.away }))
7878
);
7979

80-
export function reducer(state: State | undefined, action: Action) {
81-
return scoreboardReducer(state, action);
82-
}
8380
</code-example>
8481

8582
<div class="alert is-important">

0 commit comments

Comments
 (0)