In this exercise, the aim is to understand the concept of custom hooks.
You can follow the links below - to get a better idea of custom hooks
.
Article on custom hooks Creating useFetch - custom hook
Your task is to create a custom hook called -> useStorage
--> which stores the value typed in a text field
, both into local storage
and session storage
.
Your ouptut would look something like below:
Also, to check whether, your input is being stored or not, you can go to application
tab and see the local storage and session storage, options -> like shown below.
NOTE: Notice how, even after refreshing the page, the value in the text field, remains the same.
Happy Coding ❤️!