Concepts

TypeScript prop interface

Describe expected prop fields with a TypeScript object type; optional fields use ?, readonly restricts assignment through the type. Runtime validation is separate.

Formal Syntax & Structure

react syntaxreact
interface LabelProps { readonly text: string; }

Working Example

Example Snippetreact
interface LabelProps { readonly text: string; }function Label({ text }: LabelProps) { return <p>{text}</p>; }
React Reference