This sheet goes along with this SSH YouTube tutorial
$ ssh [email protected]
$ mkdir test
$ cd test
| /** | |
| * useScroll React custom hook | |
| * Usage: | |
| * const { scrollX, scrollY, scrollDirection } = useScroll(); | |
| */ | |
| import { useState, useEffect } from "react"; | |
| export function useScroll() { | |
| const [lastScrollTop, setLastScrollTop] = useState(0); |
| import { useState } from 'react'; | |
| export default function useLocalStorage(key, initialValue) { | |
| const [item, setInnerValue] = useState(() => { | |
| try { | |
| return window.localStorage.getItem(key) | |
| ? JSON.parse(window.localStorage.getItem(key)) | |
| : initialValue; | |
| } catch (error) { | |
| return initialValue; |
$ ssh [email protected]
$ mkdir test
$ cd test