Loading tutorials
.tsx and lets you write React markup while the compiler checks the types of everything in it. This chapter configures a project so that checking is strict and works without extra imports. Later chapters assume this setup.2 min readstrict on. It builds on typing props with an interface. The goal here is to mark props as optional, give them defaults, and understand what the compiler k2 min readstrict and jsx: "react-jsx" settings from the setup chapter.2 min readtsconfig.json from the setup chapter, with strict turned on. Here you will learn how React's event types work and how to pick the 2 min readtsconfig.json from the setup chapter. Here you will learn when useState infers its type and when you must supply one.2 min readuseState and useEffect, and that your project already compiles TSX in strict mode. useRef serves two jobs, and TypeScript treats them differently. One is holding a DOM element. The other is holding a value that can change without causing a re-render.2 min readuseReducer works in plain React and that you can read TypeScript unions and switch statements. You will type the state, describe every action as a union, and let the compiler check each case.2 min readuseState in a React function component. A custom hook is a function whose name starts with use and that calls other hooks. Typing one means describing its parameters and its return value.2 min read<T>), you know how props and map work in React, and your project compiles TSX in strict mode. You will build a list component that works with any item type while the compiler still checks every prop.2 min readuseRef for DOM nodes, ComponentPropsWithoutRef, and basic generics. The focus is how forwardRef takes two type parameters and what each one means.2 min read