Here is part of a component where I pass props as an array of objects:
const data = [
{
active: true,
status: 'Active'
},
{
active: false,
status: 'Done'
}
]
<MyComponent myProps={data} />
Here is my component where I'm trying to validate props
import React from 'react'
import { bool, string } from 'prop-types'
const MyComponent = ({ myProps }) => {
return (
<div>
<h1>Hello</h1>
</div>
)
}
MyComponent.propTypes = {
active: bool.isRequired,
status: string
}
export default MyComponent
The error I'm getting is:
The prop
activeis marked as required inMyComponent, but its value isundefined