2024-05-09
3796
#react
Chinedu Imoh
59752
May 9, 2024 ⋅ 13 min read

How to build a tab component in React

Chinedu Imoh Chinedu is a tech enthusiast focused on full-stack JavaScript and Infrastructure engineering.

Recent posts:

typescript object destructuring

TypeScript object destructuring and you

Whether you’re part of the typed club or not, one function within TypeScript that can make life a lot easier is object destructuring.

Lewis Cianci
Jan 22, 2025 ⋅ 5 min read
master state management hydration Nuxt usestate

Nuxt state management and hydration with useState

useState can effectively replace ref in many scenarios and prevent Nuxt hydration mismatches that can lead to unexpected behavior and errors.

Yan Sun
Jan 20, 2025 ⋅ 8 min read
React Native List Components: FlashList, FlatList, And More

React Native list components: FlashList, FlatList, and more

Explore the evolution of list components in React Native, from `ScrollView`, `FlatList`, `SectionList`, to the recent `FlashList`.

Chimezie Innocent
Jan 16, 2025 ⋅ 4 min read
Building An AI Agent For Your Frontend Project

Building an AI agent for your frontend project

Explore the benefits of building your own AI agent from scratch using Langbase, BaseUI, and Open AI, in a demo Next.js project.

Ivaylo Gerchev
Jan 15, 2025 ⋅ 12 min read
View all posts

6 Replies to "How to build a tab component in React"

  1. Great tutorial! I’m trying to figure out how to add a third tab. Based on `{activeTab === “tab1” ? : }` I’m guessing this isn’t possible?

  2. While this works, I’d consider using:
    – nav with a in it (no li links, semantic)
    – role and aria-* tags (screen readers)
    – useTabs hook (headless components)

    apologies if I missed one of the above while flying over it like the “veccino” (great Netflix series) and thx 4 the efforts

Leave a Reply