diff --git a/pages/index.tsx b/pages/index.tsx index df713a5..793c0f1 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,11 +1,16 @@ import type { NextPage } from 'next'; import { useRouter } from 'next/router'; -import React, { ReactElement, ReactNode } from 'react'; -import { useState } from 'react'; +import React, { ReactElement, useCallback, useEffect, useState } from 'react'; import styles from '../styles/Home.module.css'; -function Tabs(props: { children: ReactElement[] }) { - const [activeIndex, setActiveIndex] = useState(0); +interface TabsProps { + children: ReactElement[]; + selectedIndex?: number; + onTabSelected?: (index: number) => void; +} + +function Tabs(props: TabsProps) { + const activeIndex = props.selectedIndex ?? 0; if (!props.children) { return <>; } @@ -14,7 +19,9 @@ function Tabs(props: { children: ReactElement[] }) { return (