Redux & Redux Toolkit
/Advanced
Domain Driven Design
Definition
Structuring Redux state slices based on the business domain (the real-world entities the app is tracking) rather than the UI layout (the pages on the screen).
Explain Like I'm New
Don't create a `homePageSlice` and a `settingsPageSlice`. A 'User' exists on both pages. If you update the User on the Settings page, the Home page won't update because it's looking at its own slice. Create a `userSlice` (the Domain). Both pages look at the exact same Domain slice.
Real World Example
An HR application. The domains are `Employees`, `Payroll`, and `Benefits`. These are the slices. The UI pages (`Dashboard`, `Reports`) simply read from these domain slices.
Common Use Cases
- •Data consistency across multiple views
Interactive Example
Loading...
Console output will appear here...
Interview Questions
basic
- If you have a 'Checkout Page', should you create a `checkoutPageSlice`?
intermediate
- What happens if two different UI pages need to display the exact same Domain data, but sorted differently?