Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add exported reducer function to createReducer examples #1924

Merged
merged 1 commit into from
Jun 6, 2019

Conversation

brandonroberts
Copy link
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[x] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

Closes #1762

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@ngrxbot
Copy link
Collaborator

ngrxbot commented Jun 6, 2019

Preview docs changes for d20221f at https://previews.ngrx.io/pr1924-d20221f/

Copy link
Member

@timdeschryver timdeschryver left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


export function reducer(state: State | undefined: action: Action) {
return scoreboardReducer(state, action);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will only work for StoreModule.forFeature or for ReducerActionMap. I think we should recommend combineReducers way if there are more than a single reducer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I think that should be an additional section to talk about combineReducers

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't found any. Is it somewhere I missed? :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maxime1992 there's an open issue - #1179

@@ -64,26 +65,42 @@ The initial values for the `home` and `away` properties of the state are 0.

### Creating the reducer function

The reducer function's responsibility is to handle the state transitions in an immutable way. Define a reducer function that handles the actions for managing the state of the scoreboard.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't highlight it but on line 15, we define the reducer function with - The switch statement

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@brandonroberts brandonroberts force-pushed the docs-reducer-creators branch from d20221f to d3d01b1 Compare June 6, 2019 19:47
@ngrxbot
Copy link
Collaborator

ngrxbot commented Jun 6, 2019

Preview docs changes for d3d01b1 at https://previews.ngrx.io/pr1924-d3d01b1/

@brandonroberts brandonroberts merged commit 82216a5 into master Jun 6, 2019
@brandonroberts brandonroberts deleted the docs-reducer-creators branch June 6, 2019 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs: Add docs for reducer creators
5 participants