Skip to content

Instantly share code, notes, and snippets.

@alpavlove
Last active August 2, 2023 16:46
Show Gist options
  • Save alpavlove/07b8b3580e78dca1e344d7bfb615a733 to your computer and use it in GitHub Desktop.
Save alpavlove/07b8b3580e78dca1e344d7bfb615a733 to your computer and use it in GitHub Desktop.
Basic Tabs component - Tabs component with logic
import React from "react"
type Props = {
title: string
index: number
setSelectedTab: (index: number) => void
}
const TabTitle: React.FC<Props> = ({ title, setSelectedTab, index }) => {
return (
<li>
<button onClick={() => setSelectedTab(index)}>{title}</button>
</li>
)
}
export default TabTitle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment