Search code examples
ngrxngrx-storengrx-effectsangular12

How to update state data without api call with ngrx store?


I have a users list and I want to be able to update each user's details (in a modal) and keep them in the state(no API call for update). I'm trying to do this with effects but I'm not sure what is the correct way to achieve it.

Actions:

Reducer:

User details

enter image description here


Solution

  • You don't need an effect if you don't need to make an API request (or if there's no side effect). In your case, the modal dispatches an action, and the reducer listens to that action and updates the state.