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.

TypeScript with React – JSX Typi | TypeScript Mastery lesson | BraveProgrammer
  1. Courses
  2. /
  3. TypeScript Mastery

Lesson 27 of 56

·Typescript

TypeScript with React – JSX Typing

25 minutes

Course progress48%

Create a React + TS project

npx create-react-app my-app --template typescript

Functional Component Props

type GreetingProps = { name: string; age?: number };

const Greeting: .<> =  (
  
);
React
FC
GreetingProps
({ name, age }) =>
<h1>Hello, {name}{age && ` (${age})`}!</h1>

Using useState with Generics

const [count, setCount] = useState<number>(0);

useRef typing a DOM element

const inputRef = useRef<HTMLInputElement>(null);

Info

When using React.FC, the children prop is already defined. If you don’t need it, you can write a plain function component.
Make it stickPractice what you've learned1 quiz · 3 practical tests · Optional activities from TypeScript MasteryBrowse activities
Previous lessonCustom Error TypesContinue to lesson 28React Props & State TypingBack to TypeScript Mastery curriculum