Question:
How to decrease timer value inlocalstorage
by one? I used the useLocalStorage hook, but the value does not dynamically decrease by one. Thank you!Timer:
Answer:
Theuse-local-storage
hook you referred to does not support the setState(previousValue => nextValue)
syntax.The easiest way to fix this is to use a different implementation, e.g. this one: use-local-storage, used in gerrod ‘s comment
If you have better answer, please add a comment about this, thank you!