spidy
spidy

Reputation: 269

Eslint error handling react/prop-types

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. This is my first file in my application and all the other components will follow after this

import React, { Component } from "react";
import PropTypes from 'prop-types';

export default class RootPage extends Component {
render() {
    return <div>{this.props.children}</div>;
    }
}

RootPage.prototype={
    children: PropTypes.node
}

My this.props.children is throwing eslint error 'children' is missing in props validation (react/prop-types)

I have no idea how to fix it, any help is much appreciated

Thanks in advance

Upvotes: 0

Views: 566

Answers (1)

Damian Peralta
Damian Peralta

Reputation: 1876

You have a typo in propTypes (you have now prototype), try with:

RootPage.propTypes={
    children: PropTypes.node
}

Upvotes: 4

Related Questions