Skip to content

State management: combination of global and local states? #857

Answered by JessicaLoers
eneben asked this question in Web
Discussion options

You must be logged in to vote

Hello @eneben ✌️

Thanks for sharing your progress and thoughts on refactoring the state management. It looks like you’ve already made some important decisions, but you’re grappling with how best to handle the delete mode – and that's actually a very good question.

Let's break it down

Global State for All Modes

Using a global actionMode state, as you’ve implemented, works well for modes like "default" and "edit" because these states need to be consistent across the entire app. However, extending this approach to the "delete mode" has caused all flashcards to enter the delete state simultaneously, which isn’t the desired behaviour. 🫨

👍 Pros of a global state for all modes:

  • Managing all mod…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@eneben
Comment options

Answer selected by eneben
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Web
Labels
None yet
2 participants