How to fix: Prop types validation error – is missing in props validation – 2024

‘React eslint error missing in props validation’ error appears when trying to compile your React App? There are a number of ways to fix this quickly, but here’s the fastest;

To fix the ‘React eslint error missing in props validation’ when developing a React app, we can set the prop types of the props in the component causing the error.

For instance, we write:

import React from 'react'
function Header({ setIsAdding }) {
  return (
       <div><button> setIsAdding(true)} className="specialButton">
         Add Employee
export default Header

For this to work across different components, import the prop-types package to let us add prop type validation to the component.

Just run this install from the terminal and restart your development server;

npm i prop-types

PropTypes exports a range of validators that can be used to make sure the data you receive is valid. When an invalid value is provided for a prop, a warning will be shown in the JavaScript console. For performance reasons, propTypes is only checked in development mode.

Good luck!

Check out more fixes on Devs n Techies

Check Also

How to create media query for a Material UI Modal

To create a media query for a Material UI modal in React, you can use …