I'm using the Airbnb javascript standards to lint my react app and i'm getting an error i'm not sure how to fix. I'm passing in another component in order to create a page about the component itself, including the component itself (children) a title and a markdown description. I get a bunch of errors for each of those items like this.
'children' is missing in props validation - react/prop-types
I can see that it is because i'm not defining props, but I can't figure out how to get it working.
I'm essentially outputting something like the below.
const example = ({ title, children, description }) => (
{title}
{md.render(description)}
{children}
)
How would I define my Props in this situation?
I ended up working this out, I just had typos in my original code! 😅
const example = ({ title, children, description }) => (
{title}
)
example.propTypes = {
title: PropTypes.string,
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.