useLocalStorage React custom Hook
npm install react-hook-uselocalstorage``console`
npm install react-hook-uselocalstorage
And import the hook:
`javascript`
import useLocalStorage from 'react-hook-uselocalstorage';
Use it in your component:
`javascript
import React, { useRef } from 'react'
import useLocalStorage from 'react-hook-uselocalstorage'
const App = () => {
const [storageVariable, setStorageVariable] = useLocalStorage('storage data');
const inputRef = useRef(null);
const clickHandler = () => {
setStorageVariable(inputRef.current.value);
}
return (
export default App
``