update useState to useLocalStorage
This commit is contained in:
@@ -3,6 +3,7 @@ import { FaArrowLeft, FaArrowRight, FaAngleDown, FaAngleUp } from 'react-icons/f
|
|||||||
import { MdModeEdit } from 'react-icons/md';
|
import { MdModeEdit } from 'react-icons/md';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
|
import { useLocalStorage } from 'usehooks-ts';
|
||||||
|
|
||||||
import { Question, QuestionStatus } from '../../../__generated__/graphql-schema'
|
import { Question, QuestionStatus } from '../../../__generated__/graphql-schema'
|
||||||
import { useCurrentUser } from '../../../contexts';
|
import { useCurrentUser } from '../../../contexts';
|
||||||
@@ -39,7 +40,7 @@ export const QuestionsListFragments = gql`
|
|||||||
export const QuestionsList: FC<Props> = ({ questions, title, pagination }) => {
|
export const QuestionsList: FC<Props> = ({ questions, title, pagination }) => {
|
||||||
const { user } = useCurrentUser()
|
const { user } = useCurrentUser()
|
||||||
const [pageCount, setPageCount] = useState(1)
|
const [pageCount, setPageCount] = useState(1)
|
||||||
const [collapsed, setCollapsed] = useState(false)
|
const [collapsed, setCollapsed] = useLocalStorage<boolean>('collapsed', false)
|
||||||
|
|
||||||
const formatDate = (stringDate: string) => new Date(stringDate).toLocaleDateString()
|
const formatDate = (stringDate: string) => new Date(stringDate).toLocaleDateString()
|
||||||
|
|
||||||
|
|||||||
5950
package-lock.json
generated
Normal file
5950
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -38,6 +38,7 @@
|
|||||||
"postcss": "^7.0.32",
|
"postcss": "^7.0.32",
|
||||||
"postcss-cli": "^7.1.1",
|
"postcss-cli": "^7.1.1",
|
||||||
"postcss-import": "^12.0.1",
|
"postcss-import": "^12.0.1",
|
||||||
"tailwindcss": "^1.5.1"
|
"tailwindcss": "^1.5.1",
|
||||||
|
"usehooks-ts": "2.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2197
yarn-error.log
Normal file
2197
yarn-error.log
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user