PR

Prop Types

prop-types

Runtime type checking for React props and similar objects.

Utilities
react
prop-types
Utilities
javascript
npm
frontend
open source
ui
library
web
Stars
4.4k
Weekly
93M
Open issues
58
Bundle
~15 kB

Installation

npm install prop-types

Code example

import { usePropTypes } from "prop-types";

export function Example() {
  const value = usePropTypes();
  return <p>{String(value)}</p>;
}

Pros & cons

Pros

  • Actively maintained by ljharb
  • 93M weekly downloads. Battle tested
  • MIT licensed

Considerations

  • Adds roughly ~15 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 58 open issues on GitHub

FAQs

Alternatives & similar libraries