Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
seperation of component, global and server state
Browse files Browse the repository at this point in the history
  • Loading branch information
absurd-turtle committed Mar 21, 2023
1 parent d5fd3e3 commit 9c0dc45
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions doc/decisions/frontend_state_management.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Inside a React application we can usually distinguish between three types of sta

## Considered Alternatives

### Global Application State

- [Redux](https://redux.js.org/)
Requires more complex setup, boilerplate and has a steeper learning curve than Zustand.
- [React context](https://reactjs.org/docs/context.html)
Expand All @@ -27,23 +29,48 @@ Inside a React application we can usually distinguish between three types of sta
- [Recoil](https://recoiljs.org/)
Recoil is still in experimental state, not yet recommended for production (16.03.2023).

### Server State

- [SWR](https://github.com/vercel/swr)
Fewer features than React Query

## Decision

[Zustand](https://github.com/pmndrs/zustand) will be used as the state management library for PermaplanT.
### Local Component State

No library is needed.

#### Rationale

Managing component state can be accomplished with React features (useState, Context + useReducer).

## Rationale
### Global Application State

[Zustand](https://github.com/pmndrs/zustand) will be used as the global state management library for PermaplanT.

#### Rationale

Zustand is a lightweight and easy-to-use library that uses hooks, which makes it easy to integrate with React.
Its simplicity also reduces the amount of boilerplate code and the need for complex setup and configuration.

### Server State

[React Query](https://react-query-v3.tanstack.com/) will be used for managing asynchronous state

#### Rationale

React Query is a feature rich, up to date library for managing asynchronous data.

## Implications

## Related Decisions

- Choosing React as the [frontend library](./frontend_ui_framework.md) for PermaplanT

## Notes

## Links
https://medium.com/readytowork-org/its-zustand-vs-redux-8e24424df713
https://tanstack.com/query/latest/docs/react/guides/does-this-replace-client-state
https://tanstack.com/query/v4/docs/react/comparison

0 comments on commit 9c0dc45

Please sign in to comment.