0

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

0

1 Answer 1

4

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

RootPage.propTypes={
    children: PropTypes.node
}
Sign up to request clarification or add additional context in comments.

1 Comment

@spidy, if it worked, could you please mark your question as answered?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.