Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

React Props & State Typing | TypeScript Mastery lesson | BraveProgrammer
  1. Courses
  2. /
  3. TypeScript Mastery

Lesson 28 of 56

·Typescript

React Props & State Typing

20 minutes

Course progress50%

Props Interface

interface CardProps {
  title: string;
  description?: string;
}

const Card: React.FC<CardProps> =  (
  
);
({ title, description }) =>
<div> <h2>{title}</h2> {description && <p>{description}</p>} </div>

State with Union Types

type Status = "idle" | "loading" | "error";
const [status, setStatus] = useState<Status>("idle");

Context Typing

interface ThemeContextProps { dark: boolean; toggle(): void; }
const ThemeContext = React.createContext<ThemeContextProps | undefined>(undefined);

Info

Never expose any in component props – it defeats the purpose of TypeScript.
Make it stickPractice what you've learned1 quiz · 3 practical tests · Optional activities from TypeScript MasteryBrowse activities
Previous lessonTypeScript with React – JSX TypingContinue to lesson 29React Hooks – `useState`, `useEffect` TypesBack to TypeScript Mastery curriculum