What are the benefits of NgRx Ducks?

  • ⚙️ Create both Reducer and Action Automatically
  • 🤫 Get rid of verbose action declarations
  • ️️️⤵️ Reduce imports of Action Types and Action Creators
  • 💉 Use typed Services instead of dispatching Actions
  • 🙅‍ No code generation that needs to be maintained manually

What is a Duck?

A Duck bundles the tasks of
As user, you only need to declare which method needs to be executed when a certain action is dispatched. Multiple Ducks are used to generate the Reducer automatically. You end up writing a class containing pure functions. Leave the rest to @ngrx-ducks/core. Components are fully independent of Redux-Architecture

Which version of ngrx is supported?

The version number of @ngrx-ducks is aligned with ngrx/platform. The major versions of both projects are compatible with each other.

What happens to the previous Decorator-API?

Short answer: Nothing
👍 The Decorator API is still there and can be used. If you already use NgRx Ducks you do not have to worry about breaking changes in your app.

Why does the Decorator-API needs a successor?

Short answers:
  • Better compatibility with NgRx’s types
  • Reduction of boilerplate
  • Make component fully independent of Redux-Architecture
  • Even better type-support
There are various reasons that motivated to improve the API of NgRx Ducks. A video discusses the differences in more detail. You are welcome to join the discussion.

What about Angular 8?

The new API isn’t only ready for Angular 9. 🎉 Since NgRx-Ducks 8.4 you can already benefit from createDuck and its friends.
Please note that NgRx Ducks 8 is hosted under the co-IT scope. You need to run npm install @co-it/[email protected] to get the Angular 8 compatible version.
Last modified 2yr ago