Props Validation in React
Validation means catching wrong prop types before the UI silently breaks. New apps: TypeScript — amount: number on the component props type. Old JS apps: the prop-types package, Hello.propTypes = { name: PropTypes.string.isRequired }.
PropTypes usually warn in development, they don’t always crash production. Don’t treat them as security. They’re a teacher’s red pen, not a firewall.
Props Validation in React — output — warn: name should be string. PropTypes warn in dev. TS catches this at compile.
Parent
│ amount={199}
▼
Price → ₹199TS first. PropTypes in legacy JS.