- Do not allow constuctor in React Components
- Force static propTypes proporty
I am not sure if this rules should be here. Maybe it is better to create a pull request to eslint-plugin-react
Considered bad:
class List extends React.Component {
constructor(props) {
super(props);
}
handleClick() {
}
render() {
<button onClick={this.handleClick} />
}
}
Considered good:
class List extends React.Component {
static propTypes = {};
state = {};
handleClick = () => {
};
render() {
<button onClick={this.handleClick} />
}
}
I am not sure if this rules should be here. Maybe it is better to create a pull request to eslint-plugin-react
Considered bad:
Considered good: