Closed joe-dev-public closed 2 years ago
Name | Link |
---|---|
Latest commit | 33bf5a3a39661577d94ae4c6415b23b4f9c45413 |
Latest deploy log | https://app.netlify.com/sites/alislearning/deploys/62d826f3514435000ae598a7 |
Deploy Preview | https://deploy-preview-52--alislearning.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
To use it, you have to include this line at the start of the relevant page:
import useLocalStorageState from "../components/Hooks/useLocalStorageState";
(Make sure you use the right path :)
And put this line inside the main function:
const [foo, setFoo] = useLocalStorageState("hello", "world") || [null, null];
Note: "hello" is the key name, and "world" is the initial value. It could be another data type, e.g. array, object, etc., not just a string.
That [null, null] thing is hacky, I don't like it! Makes me think I haven't done this the right way. A little test works but I haven't tested extensively so it might break 😁