Sets up storage of the config object in localStorage as well as automatic updates to the localStorage value when the config changes.
Bug Fixes / Minor Changes
N/A
Why
It is nice if the user's configuration is saved between sessions and localStorage is a convenient place for it.
How
Check if the key in localStorage exists and if it does, set the config to the parsed JSON. If it doesn't exist, assign the default config. Use the useEffect hook with a dependency on the config to update the localStorage value as needed.
Notes
With a possibly fetched word list specified in the stored config, the word list should now be populated with a fetch request. However, attempting to do so leads to some errors. This should be investigated, but for now, it at least saves the config...it just forces the default word list on the user to start.
Changes
Major Changes
Sets up storage of the config object in localStorage as well as automatic updates to the localStorage value when the config changes.
Bug Fixes / Minor Changes
N/A
Why
It is nice if the user's configuration is saved between sessions and localStorage is a convenient place for it.
How
Check if the key in localStorage exists and if it does, set the config to the parsed JSON. If it doesn't exist, assign the default config. Use the useEffect hook with a dependency on the config to update the localStorage value as needed.
Notes
With a possibly fetched word list specified in the stored config, the word list should now be populated with a fetch request. However, attempting to do so leads to some errors. This should be investigated, but for now, it at least saves the config...it just forces the default word list on the user to start.