Skip to content

Instantly share code, notes, and snippets.

@sabesansathananthan
Last active November 3, 2019 13:44
Show Gist options
  • Save sabesansathananthan/f3adbd85b8cba252646319f5ba89be2f to your computer and use it in GitHub Desktop.
Save sabesansathananthan/f3adbd85b8cba252646319f5ba89be2f to your computer and use it in GitHub Desktop.
stateless Class component in React Best practices in React
import React, { Component } from 'react';
class Button extends Component {
render() {
const { children, color, onClick } = this.props;
return (
<button onClick={onClick} className={`Btn ${color}`}>
{children}
</button>
);
}
}
export default Button;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment