diff --git a/src/app/cks/page.tsx b/src/app/cks/page.tsx index d211d2a..a2ca5ed 100644 --- a/src/app/cks/page.tsx +++ b/src/app/cks/page.tsx @@ -44,9 +44,7 @@ export default function CKS() { ); }); }, [questions]); - const [current, setCurrent] = useState( - contents ? { id: 0, content: contents[0] } : null - ); + const [current, setCurrent] = useState({ id: 0, content: contents[0] }); const ref = useRef(null); const answer = useMemo(() => { return ( @@ -96,7 +94,7 @@ export default function CKS() { className="answer" onClick={() => scrollToAnswer( - `question-${current?.id}-|-${idMaps[current!.id - 1]}` + `question-${current.id + 1}-|-${idMaps[current!.id]}` ) } >