Concept
Declare a component's props as a type or interface, with optional ones marked. The compiler then checks every usage of the component and documents what it accepts.
The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.
A few lines that show Typing props doing its job.
type ButtonProps = {
variant?: "primary" | "ghost";
disabled?: boolean;
onClick: () => void;
children: React.ReactNode;
};
export function Button({ variant = "primary", ...rest }: ButtonProps) {
return <button className={"btn-" + variant} {...rest} />;
}Typing props with React.FC and relying on its implicit children. It hides which components really accept children, and newer React types no longer add children for you.
Your roadmap puts these before Typing props, unless you already know them.
Once a session shows you understand Typing props, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.
Topics that build on Typing props.