Nx: NgRx Schematic: Use Enum for Action Names

Created on 31 Oct 2017  路  2Comments  路  Source: nrwl/nx

feature

Most helpful comment

Better yet, consider adopting
https://github.com/cartant/ts-action
and
https://github.com/cartant/ts-action-operators.

Uses "action creators" which allow you to declare actions using a much less verbose syntax. Also adds the type as a static property to the action, which allows you to filter action types in your reducer using Action.type. This gets rid of the need to export action names from your action file altogether, you only need to export the actions themselves.

All 2 comments

Better yet, consider adopting
https://github.com/cartant/ts-action
and
https://github.com/cartant/ts-action-operators.

Uses "action creators" which allow you to declare actions using a much less verbose syntax. Also adds the type as a static property to the action, which allows you to filter action types in your reducer using Action.type. This gets rid of the need to export action names from your action file altogether, you only need to export the actions themselves.

We switched to using the default NgRx schematics fo generating actions. Our goal is to be as close to the default schematics as possible. Currently they use classes, but it may change in NgRx 6.

Closing this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

olakara picture olakara  路  3Comments

markphip picture markphip  路  3Comments

danieldanielecki picture danieldanielecki  路  3Comments

Svancara picture Svancara  路  3Comments

vimalraj-a picture vimalraj-a  路  3Comments