-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Information
Hello NgRx Team,
I noticed a small typo in the code example on the official documentation page for createFeature.
In the products.feature.ts example, there is a missing comma inside the on() function between the action (ProductsApiActions.loadSuccess) and the reducer callback function.
Current Code (Incorrect):
const productsFeature = createFeature({ name: 'products', reducer: createReducer( initialState, on(ProductsApiActions.loadSuccess(state, { products }) => ({ ...state, products, })), ), });
Proposed Correction:
A comma should be added after ProductsApiActions.loadSuccess to correctly separate the action from the reducer.
const productsFeature = createFeature({ name: 'products', reducer: createReducer( initialState, on(ProductsApiActions.loadSuccess, (state, { products }) => ({ ...state, products, })), ), });
This is a minor fix, but it will help prevent confusion for new developers learning the createFeature API.
Thank you!
Documentation page
https://v18.ngrx.io/api/store/createFeature
I would be willing to submit a PR to fix this issue
- Yes
- No