Marko Stanimirović

NgRx Tips for Future-Proof Angular Apps

Are your NgRx actions making your app harder to debug? Learn how good action hygiene can future-proof your state management and simplify your Angular application.

NgRx Tips for Future-Proof Angular Apps
#1about 4 minutes

Consolidate global state into a single NgRx store

Avoid splitting global state between NgRx and stateful services to improve reusability and reduce component dependencies.

#2about 2 minutes

Use selectors to compute derived state on demand

Calculate derived data using memoized selectors instead of storing it in the state to simplify reducers and reduce state size.

#3about 2 minutes

Simplify components with view model selectors

Combine multiple state slices into a single view model selector to simplify component logic and template bindings.

#4about 1 minute

Create reusable and maintainable case reducers

Handle multiple actions in a single case reducer for shared logic, but split them into separate reducers when state changes diverge.

#5about 4 minutes

Treat actions as unique events, not commands

Use the source-event pattern to name actions descriptively, avoiding sequential dispatches and improving application traceability.

#6about 2 minutes

Organize actions by grouping them by source

Structure your codebase by creating dedicated action files for each source, such as pages, APIs, or guards.

#7about 1 minute

Name NgRx effects based on their function

Name effects based on the task they perform rather than the action they listen to, improving readability and maintainability.

#8about 2 minutes

Keep effects simple by moving logic to services

Isolate complex business logic within services and call them from effects to keep the effects simple, readable, and easy to test.

#9about 1 minute

Avoid creating unnecessary boilerplate effects

Eliminate intermediate effects by having the primary effect listen to multiple source actions directly, reducing boilerplate code.

#10about 2 minutes

Apply good action hygiene within NgRx effects

Return a single unique event with a complete data payload from an effect instead of an array of command actions to decouple state updates.

#11about 3 minutes

Adopting NgRx best practices for future-proof apps

Following established best practices for NgRx store and effects improves code quality, maintainability, and performance in large Angular applications.

Related jobs
Jobs that call for the skills explored in this talk.

Angular Developer

Picnic Technologies B.V.
Amsterdam, Netherlands

Intermediate
Senior

Featured Partners

Related Articles

View all articles
BR
Benjamin Ruschin
The HTML Elements That You’re Probably Over-Engineering
As frameworks have become more and more commonplace in the world of web development, so too has the over-engineering of features made possible by our humble old friend, HTML. The mental models that come with using state management in React, Vue and o...
The HTML Elements That You’re Probably Over-Engineering
BR
Benjamin Ruschin
What Developers Really Need to Create Great Code Demos
Every developer on earth has, at some point, had another developer to thank for a breakthrough, a success, an aha moment they wouldn’t have had without coming across that blog post, that open-source contribution, that reply on socials or that humble ...
What Developers Really Need to Create Great Code Demos
DC
Daniel Cranney
Dev Digest 188: CfP time, the risks of NPM and IKEA algorithms
Inside last week’s Dev Digest 188 . 🤖 GitHub Copilot CLI is now in public review 💻 Microsoft is bringing ‘vibe working’ to office apps 🎣 Attackers abuse AI tools to generate captchas in fishing attacks ⚠️ When LLMs autonomously attack 🧠 Common cause...
Dev Digest 188: CfP time, the risks of NPM and IKEA algorithms
DC
Daniel Cranney
Dev Digest 179: rm -rf, Agent Style, NPM hacks & Browser Design Tools
Inside last week’s Dev Digest 179 . 🌍 AI is eating the internet 💡 Reverse engineering GitHub Spark with itself 📦 NPM under attack - ‘is’ package compromised ⚠️ AI code assistant almost wiped the computers of 1M users 📝 The State of HTML Survey is op...
Dev Digest 179: rm -rf, Agent Style, NPM hacks & Browser Design Tools

From learning to earning

Jobs that call for the skills explored in this talk.