Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. const TestComponent = () => {
  2. const [timesPressed, setTimesPressed, isLoadingTimesPressed, err] = useClientStorage('totalButtonPresses', 0);
  3.  
  4. return (
  5. <div>
  6. <div><button onClick={() => setTimesPressed(timesPressed + 1)}>Click Me</button></div>
  7. <div>Total presses: {isLoadingTimesPressed ? 'loading from local storage...' : timesPressed}</div>
  8. </div>
  9. )
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement