Fermain / thermal-rising-pwa

PWA for Thermal Rising
0 stars 0 forks source link

4 implement state management strategy #20

Closed Menubrea closed 1 year ago

Menubrea commented 1 year ago

If anyone have any reservations on using Zustand, or would prefer a different library for ´State-management` and/or if there is anything specific you would like implemented at this point in time, please let me know.

Menubrea commented 1 year ago

Updates

Let me know what you think about the updated structure.

import { useStore } from '~/store'

// Destructured
const { count, increment } = useStore();
// alternatively using dot notation, which will expose all available properties as a list.
let count = useStore().count;
kyrregjerstad commented 1 year ago

I'm a fan of the Destructured method

Anclagen commented 1 year ago

Looks good to me, I think Zustand will server are purposes for a small scale app. One thing I was wondering is will we need to use something like SWR or React Query for caching progress server side, although we can just update the database as checks are complete too, but might be something for consideration.

Menubrea commented 1 year ago

Looks good to me, I think Zustand will server are purposes for a small scale app. One thing I was wondering is will we need to use something like SWR or React Query for caching progress server side, although we can just update the database as checks are complete too, but might be something for consideration.

Absolutely, great input! Luckily for us tPRC's queries functions as a wrapper around React Query hooks. For any server data, I anticipate queries will be our go-to for caching and state-management.