frontend add

This commit is contained in:
shinmj
2021-10-21 09:03:17 +09:00
parent 8caa4bbc5a
commit cb9d50511e
443 changed files with 88282 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
import { pageAtom, pageSelector } from '@stores'
import { useState } from 'react'
import { useRecoilValue, useSetRecoilState } from 'recoil'
export default function usePage(conditionKey: string, initPage: number = 0) {
const pageState = useRecoilValue(pageAtom(conditionKey))
const setValue = useSetRecoilState(pageSelector(conditionKey))
const [page, setPage] = useState<number>(pageState || initPage)
const setPageValue = (num: number) => {
setValue(num)
setPage(num)
}
return { page, setPageValue }
}