Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
building stuff

Viliam Simko vsimko

💭
building stuff
View GitHub Profile
@indiesquidge
indiesquidge / objects-over-classes.md
Last active Aug 4, 2020
We are better off avoiding ES6 classes in JavaScript when possible
View objects-over-classes.md

Plain JavaScript objects are better than classes when they can be used, and many popular modern frameworks have adopted their use.

Consider that in React a component can be created as either a class or as an object.

// using a class
class Welcome extends React.Component {
  render() {
    <h1>Hello, {this.props.name}</h1>
You can’t perform that action at this time.