()
| 3 | import { useLocalStorage } from './useLocalStorage'; |
| 4 | |
| 5 | const Demo = () => { |
| 6 | const [value, setValue] = useState(''); |
| 7 | |
| 8 | const { getItem, setItem, removeItem } = useLocalStorage('value'); |
| 9 | |
| 10 | return ( |
| 11 | <div className='tutorial-shorts'> |
| 12 | <h1 className='mb-2 text-3xl font-bold'>useLocalStorage</h1> |
| 13 | <input |
| 14 | className='mb-4' |
| 15 | type='text' |
| 16 | value={value} |
| 17 | onChange={(e) => setValue(e.target.value)} |
| 18 | /> |
| 19 | <div className='flex flex-row gap-4'> |
| 20 | <button onClick={() => setItem(value)}>Set</button> |
| 21 | <button onClick={() => console.log(getItem())}>Get</button> |
| 22 | <button onClick={removeItem}>Remove</button> |
| 23 | </div> |
| 24 | </div> |
| 25 | ); |
| 26 | }; |
| 27 | |
| 28 | export default Demo; |
nothing calls this directly
no test coverage detected