ESLint react/prop-types reports a prop as missing in props validation
'name' is missing in props validationShort answer
The react/prop-types rule found a prop your component reads that has no declared type. In plain JavaScript, add a propTypes block. In TypeScript, add the prop to the component's props type. In React 19, propTypes checks are removed from React, so TypeScript is the real fix.
Fix it fast
1Find out which cause you have
Run ESLint on the one file and read which prop and which line the rule reports.
npx eslint src/components/Hello.jsx --rule 'react/prop-types: error'2Match what you see, then jump to its fix
- 1
'name' is missing in props validation on a .jsx fileA JavaScript component does not declare its propsFix - 2
'name' type is missing in props validation on a .tsx fileA TypeScript props type is missing one of the propsFix - 3
The rule is satisfied, yet wrong prop types produce no warning in the consoleThe project is on React 19 and PropTypes no longer runFix
- 1
What does the error look like?
'name' is missing in props validation'lastname' type is missing in props validationreact/prop-types
Cause 1 of 3
A JavaScript component does not declare its props
1Check
The rule reports props a function or class component uses without a propTypes entry.
grep -rn "propTypes" src/components/Hello.jsx2Fix
Declare every prop the component reads. Use PropTypes.node for children.
import PropTypes from 'prop-types';
function Hello({ name }) {
return <div>Hello {name}</div>;
}
Hello.propTypes = {
name: PropTypes.string.isRequired,
};3Verify
Run the linter again on the file.
npx eslint src/components/Hello.jsxConfirmed by github.com
Cause 2 of 3
A TypeScript props type is missing one of the props
1Check
The rule accepts TypeScript as validation, and reports a prop that is read but absent from the type.
grep -n "interface\|type .*Props" src/components/Hello.tsx2Fix
Add the missing field to the interface or type alias the component uses.
interface Props {
name: string;
age: number;
}
function Hello({ name, age }: Props) {
return <div>Hello {name}, {age}</div>;
}3Verify
Run the linter and the type check.
npx eslint src/components/Hello.tsx
npx tsc --noEmitConfirmed by github.com
Cause 3 of 3
The project is on React 19 and PropTypes no longer run
1Check
React 19 removed propTypes checks from the React package, and using them is silently ignored.
npm ls react2Fix
Move to TypeScript for prop checks, use default parameters instead of defaultProps on function components, and turn the rule off for files already typed. The React team offers a codemod for the conversion.
npx codemod@latest react/prop-types-typescript3Verify
Run the type check; wrong props are now reported at compile time.
npx tsc --noEmitConfirmed by react.dev
How do I stop it coming back?
- Pick one way to validate props in a project and enforce it.
- Use default parameter values on function components instead of defaultProps.
- Keep props types next to the component so a new prop is added in the same edit.
- In a TypeScript project, turn off react/prop-types for .tsx files if the rule is noisy.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Web apps
TypeScript refuses JSX because the jsx option is not set
TS17004: Cannot use JSX unless the '--jsx' flag is provided.
TypeScript compiles JSX only when you name the file with a .tsx extension and enable the jsx compiler option.
2 causes, each with a fixWeb apps
TypeScript rejects a component that returns an array or other non-Element
Its return type 'Element[]' is not a valid JSX element.
TypeScript before 5.1 required every component to return JSX.Element or null, so arrays, strings and Promises were rejected even though React renders them.
2 causes, each with a fixWeb apps
ESLint says it cannot resolve a path to a module that does exist
Unable to resolve path to module 'react'. import/no-unresolved
import/no-unresolved fails when eslint-plugin-import cannot find the file or package on disk with its resolver.
4 causes, each with a fixWeb apps
ESLint reports no-unused-vars for React components and imports that are used
no-unused-vars reported for a component that is rendered as a JSX tag
ESLint's core no-unused-vars does not see variables used only as JSX tags, so a component imported and rendered as <Hello /> looks unused.
3 causes, each with a fixWeb apps
TypeScript rejects MUI Data Grid columns that set a type
A TypeScript error inside a column's renderCell callback
A columns array declared without a type is inferred with type as a plain string, which the Data Grid's column type union does not accept.
2 causes, each with a fixWeb apps
The renderInput prop stopped working on the MUI X DatePicker
The custom TextField (variant, size, helperText) is ignored
renderInput was removed from the MUI X date pickers in version 6.
3 causes, each with a fix