SlideShare a Scribd company logo
Reduce your Angular state
options with NGXS
Yohan Lasorsa
 github.com/sinedied
 @sinedied
1988
1997
2012
2014
2015
2018
Command-Query Separation (CQS)
Functional Reactive Programming (FRP)
Elm
Flux architecture (React)
Redux, (few months later) NGRX, VueX
NGXS (february!)
State management, where does it come from?
Reduce your Angular state options with NGXS
Single source of truth
The state of your whole application is stored in an object tree within a single store.
State is read-only
The only way to change the state is to emit an action, an object describing what
happened.
Changes are made with pure functions
To specify how the state tree is transformed by actions, you write pure reducers.
The Redux 3 principles
Redux data flux
Use Redux directly
(You really don't want to...)
What about Angular?
Use NGRX
It's redux fit for Angular and RxJS
With the same issues as redux
Side effects (async...) are 2nd class citizen
Without benefits from Angular patterns
It's still pure functions (no class, no DI)
No use of @annotations for actions, selectors
Boilerplate even worse than Redux
What about Angular?
There comes
   
Born from NGRX frustration
Spiritual descendant of ngrx-actions
The good parts
Reduced boilerplate ❤
Leverage Angular powers
Side effects are 1st class citizen
Simpler to learn and use
Young, but same (advanced) features (router, devtools, meta...) as NGRX
NGXS
4 concepts
Store Global state container, action dispatcher and selector
Action Class describing the action to take and its associated metadata
State Class definition of the state
Select State slice selectors
NGXS basics
NGXS website
Why another state management framework for Angular?
Redux website
NGRX libs
Comprehensive Introduction to @ngrx/store
Markdown Editor variants:
Angular without state management
Angular with NGRX
Angular with NGXS
React with Rexux
Vue with VueX
Links

More Related Content

PDF
Insect Pest ID and Life Cycle
PDF
The Road To Redux
PDF
Top 20 ReactJS Interview Questions and Answers in 2023.pdf
PDF
React JS & Functional Programming Principles
PPTX
𝐀𝐧 𝐈𝐧𝐭𝐞𝐫𝐚𝐜𝐭𝐢𝐯𝐞 𝐒𝐞𝐬𝐬𝐢𝐨𝐧 𝐨𝐧 𝐀𝐧𝐠𝐮𝐥𝐚𝐫 𝐍𝐠𝐑𝐱 𝐛𝐲 𝐀𝐧𝐠𝐮𝐥𝐚𝐫 𝐃𝐞𝐯𝐞𝐥𝐨𝐩𝐦𝐞𝐧𝐭 𝐓𝐞𝐚𝐦
PDF
A React Journey
PDF
Redux in Angular 2+
PDF
Getting started with React and Redux
Insect Pest ID and Life Cycle
The Road To Redux
Top 20 ReactJS Interview Questions and Answers in 2023.pdf
React JS & Functional Programming Principles
𝐀𝐧 𝐈𝐧𝐭𝐞𝐫𝐚𝐜𝐭𝐢𝐯𝐞 𝐒𝐞𝐬𝐬𝐢𝐨𝐧 𝐨𝐧 𝐀𝐧𝐠𝐮𝐥𝐚𝐫 𝐍𝐠𝐑𝐱 𝐛𝐲 𝐀𝐧𝐠𝐮𝐥𝐚𝐫 𝐃𝐞𝐯𝐞𝐥𝐨𝐩𝐦𝐞𝐧𝐭 𝐓𝐞𝐚𝐦
A React Journey
Redux in Angular 2+
Getting started with React and Redux

Similar to Reduce your Angular state options with NGXS (20)

PDF
100 React Interview questions 2024.pptx.pdf
PDF
Fabio Biondi - Front-end data architectures in Angular, Redux & NGRX - Codemo...
PDF
React.js and Redux overview
PPTX
downloads_introduction to redux.pptx
PPTX
Top 20 ReactJS Interview Questions and Answers in 2023.pptx
PDF
All about React Js
ODP
Controller design-pattern-drupal-north-toronto-2018-final
PDF
REACTJS.pdf
PPTX
Introduction to React JS for beginners | Namespace IT
PPTX
Reactive Programming on Android - RxAndroid - RxJava
PDF
Understanding react hooks
PDF
Corso su ReactJS
PDF
React Interview Question PDF By ScholarHat
PPTX
Combining Angular and React Together
PPTX
React JS Interview Question & Answer
PPTX
React js introduction about it's features
PDF
ReactJS - A quick introduction to Awesomeness
PPTX
React + Redux + TypeScript === ♥
PPTX
PPTX
Introduction to React JS.pptx
100 React Interview questions 2024.pptx.pdf
Fabio Biondi - Front-end data architectures in Angular, Redux & NGRX - Codemo...
React.js and Redux overview
downloads_introduction to redux.pptx
Top 20 ReactJS Interview Questions and Answers in 2023.pptx
All about React Js
Controller design-pattern-drupal-north-toronto-2018-final
REACTJS.pdf
Introduction to React JS for beginners | Namespace IT
Reactive Programming on Android - RxAndroid - RxJava
Understanding react hooks
Corso su ReactJS
React Interview Question PDF By ScholarHat
Combining Angular and React Together
React JS Interview Question & Answer
React js introduction about it's features
ReactJS - A quick introduction to Awesomeness
React + Redux + TypeScript === ♥
Introduction to React JS.pptx
Ad

Recently uploaded (20)

PDF
Understanding Forklifts - TECH EHS Solution
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PDF
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
L1 - Introduction to python Backend.pptx
PDF
System and Network Administration Chapter 2
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Designing Intelligence for the Shop Floor.pdf
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Digital Strategies for Manufacturing Companies
Understanding Forklifts - TECH EHS Solution
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Which alternative to Crystal Reports is best for small or large businesses.pdf
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Oracle E-Business Suite: A Comprehensive Guide for Modern Enterprises
Odoo Companies in India – Driving Business Transformation.pdf
iTop VPN Free 5.6.0.5262 Crack latest version 2025
EN-Survey-Report-SAP-LeanIX-EA-Insights-2025.pdf
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
L1 - Introduction to python Backend.pptx
System and Network Administration Chapter 2
Design an Analysis of Algorithms II-SECS-1021-03
Designing Intelligence for the Shop Floor.pdf
Odoo POS Development Services by CandidRoot Solutions
Wondershare Filmora 15 Crack With Activation Key [2025
CHAPTER 2 - PM Management and IT Context
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Digital Strategies for Manufacturing Companies
Ad

Reduce your Angular state options with NGXS

  • 1. Reduce your Angular state options with NGXS Yohan Lasorsa  github.com/sinedied  @sinedied
  • 2. 1988 1997 2012 2014 2015 2018 Command-Query Separation (CQS) Functional Reactive Programming (FRP) Elm Flux architecture (React) Redux, (few months later) NGRX, VueX NGXS (february!) State management, where does it come from?
  • 4. Single source of truth The state of your whole application is stored in an object tree within a single store. State is read-only The only way to change the state is to emit an action, an object describing what happened. Changes are made with pure functions To specify how the state tree is transformed by actions, you write pure reducers. The Redux 3 principles
  • 6. Use Redux directly (You really don't want to...) What about Angular?
  • 7. Use NGRX It's redux fit for Angular and RxJS With the same issues as redux Side effects (async...) are 2nd class citizen Without benefits from Angular patterns It's still pure functions (no class, no DI) No use of @annotations for actions, selectors Boilerplate even worse than Redux What about Angular?
  • 9. Born from NGRX frustration Spiritual descendant of ngrx-actions The good parts Reduced boilerplate ❤ Leverage Angular powers Side effects are 1st class citizen Simpler to learn and use Young, but same (advanced) features (router, devtools, meta...) as NGRX NGXS
  • 10. 4 concepts Store Global state container, action dispatcher and selector Action Class describing the action to take and its associated metadata State Class definition of the state Select State slice selectors NGXS basics
  • 11. NGXS website Why another state management framework for Angular? Redux website NGRX libs Comprehensive Introduction to @ngrx/store Markdown Editor variants: Angular without state management Angular with NGRX Angular with NGXS React with Rexux Vue with VueX Links