djbowen95 / Hit-the-Bucket

Front-end BUCKET LIST application built with REACT. Users can add, update or delete items from a bucket list - which persists when they refresh or revisit the page. Uses STATE, HOOKS, COMPONENTS, PROPS, conditional rendering, forms and event handling. Built from starter code.
https://djbowen95.github.io/Hit-the-Bucket/
MIT License
0 stars 0 forks source link

Modularise localStorage functions currently in BucketList.js: fetch/check and returnDefaultBucket() #26

Open djbowen95 opened 1 year ago

djbowen95 commented 1 year ago

There are currently two functions in BucketList.js which are used to check if there is existing user bucket list data stored in localStorage, or to give a set of default values if there is not. They are required in order to render the page / fetch user data.

They are currently part of the BucketList.js file but I think they might be better as a module:

Also want to:

Also I think in line with object oriented programming principles, I might want to separate the 'check/fetch' function into two separate functions; each function to do one thing; this function both checks whether there is a truthy localStorage object AND fetches the data from it if there is.