move to Donetick Org, First commit frontend

This commit is contained in:
Mo Tarbin 2024-06-30 18:55:39 -04:00
commit 2657469964
105 changed files with 21572 additions and 0 deletions

View file

@ -0,0 +1,16 @@
import { useEffect, useState } from 'react'
const useStickyState = (defaultValue, key) => {
const [value, setValue] = useState(() => {
const stickyValue = window.localStorage.getItem(key)
return stickyValue !== null ? JSON.parse(stickyValue) : defaultValue
})
useEffect(() => {
window.localStorage.setItem(key, JSON.stringify(value))
}, [key, value])
return [value, setValue]
}
export default useStickyState