React and TypeScript
Typed state union
An explicit state type permits multiple intentional value shapes.
Formal Syntax & Structure
react syntaxreact
useState<string | null>(null)Working Example
Example Snippetreact
useState<string | null>(null)An explicit state type permits multiple intentional value shapes.
useState<string | null>(null)useState<string | null>(null)