Skip to content

NgRx V18 - Documenation for CreateFeature has a small but important Error #4967

@DavidGoestemeier

Description

@DavidGoestemeier

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions