astarte-platform / astarte-dashboard

Astarte dashboard
http://astarte-platform.org
Apache License 2.0
16 stars 18 forks source link

State management approach for the Dashboard #301

Open davidebriani opened 3 years ago

davidebriani commented 3 years ago

As we keep evolving the Dashboard, we'd like to have a streamlined and consistent way to manage state and data within the web app. Several factors should be considered for each potential approach:

davidebriani commented 3 years ago

Here are three libraries with distinct approaches to state management that we can evaluate.

Redux

Architecture Async data Data persistency Typescript support Testing/debugging Community/Ecosystem
Flux, clean and opinionated but boilerplaty Needs additional (opinionated) middleware: redux-thunk, redux-saga With redux-persist Yes, boilerplaty Great. Redux DevTools and time-travel Rich and mature

Pros:

Cons:

Recoil

Architecture Async data Data persistency Typescript support Testing/debugging Community/Ecosystem
Atomic, simple and follows React style Easy to do and supports concurrent mode/Suspense No support but can be easily done manually Yes Good. Time-travel and snapshots Young, still experimental

Pros:

Cons:

MobX

Architecture Async data Data persistency Typescript support Testing/debugging Community/Ecosystem
Proxy, OOP style. Opinionated with MobX-State-Tree Easy to do but up to you No support but can be easily done manually Yes Good, has a DevTools extension Not so stable APIs but mature ecosystem

Pros:

Cons: