Skip to content

Commit

Permalink
docs: remove references to wrapped reducer function (#3200)
Browse files Browse the repository at this point in the history
Closes #3192
  • Loading branch information
AleenaSA authored Oct 25, 2021
1 parent 34647eb commit 665187f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
11 changes: 2 additions & 9 deletions projects/ngrx.io/content/guide/entity/adapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,7 @@ export const initialState: State = adapter.getInitialState({
selectedUserId: null,
});

const userReducer = createReducer(initialState);

export function reducer(state: State | undefined, action: Action) {
return userReducer(state, action);
}
export const userReducer = createReducer(initialState);
</code-example>

## Adapter Collection Methods
Expand Down Expand Up @@ -149,7 +145,7 @@ export const initialState: State = adapter.getInitialState({
selectedUserId: null,
});

const userReducer = createReducer(
export const userReducer = createReducer(
initialState,
on(UserActions.addUser, (state, { user }) => {
return adapter.addOne(user, state)
Expand Down Expand Up @@ -198,9 +194,6 @@ const userReducer = createReducer(
})
);

export function reducer(state: State | undefined, action: Action) {
return userReducer(state, action);
}

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

Expand Down
5 changes: 1 addition & 4 deletions projects/ngrx.io/content/guide/store/reducers.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,14 @@ The initial values for the `home` and `away` properties of the state are 0.
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.

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

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

<div class="alert is-important">
Expand Down

0 comments on commit 665187f

Please sign in to comment.