utmmcss / mcss-website-frontend

MCSS Website Frontend
https://mcss.club
MIT License
0 stars 1 forks source link

Investigate removable dependencies (i.e redux) #98

Open HenrikSZ opened 1 month ago

HenrikSZ commented 1 month ago

Remove redux and redux toolkit dependencies. Instead use tanstack react-query.

See the overview here: https://tanstack.com/query/latest/docs/framework/react/overview

You can usually create the query hooks like this:

const useEventQuery = () => useQuery({
    queryKey: ['eventsData'],
    queryFn: () => {
      try {
        return await fetchHelper({
           base: 'CMS',
           url,
       });
     } catch (error) {
       console.log(error);
       throw error;
     }
   }
  })

This also includes removing the context / useApi.