Creating a basic tab component

Our job now is to separate the description from the reviews using a tab component that we are going to build. We are going to create a simple tab component first and refactor this into the compound component pattern in the next section.

It's time to start on our tab component:

  1. First, let's create a file called Tabs.tsx for our tab component with the following content in it as a skeleton class component:
import * as React from "react";interface IProps {}interface IState {}class Tabs extends React.Component<IProps, IState> {  public constructor(props: IProps) {    super(props);    this.state = {};  }  public render() {    return;  }}export default Tabs;

We have chosen to create a class-based component because our component ...

Get Learn React with TypeScript 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.