DEV Community

Discussion on: Rethinking JavaScript: The complete elimination and eradication of JavaScript's this.

Collapse
 
joelnet profile image
JavaScript Joel

These comments were expected ;) Don't worry, it in no way discourages me. Having written many similar articles:

This response was expected. People subconsciously put up barriers against change.

The first barrier is The Familiarity Heuristic, (oversimplified) says when given two options a person will prefer the familiar option.

Another barrier is the Mere-exposure effect, which states you'll develop a preference for something simply by having repeated exposure to it.

There's also the sense of accomplishment for having conquered this. this is a right of passage for JavaScript developers and if I went through the pain of this, then all new developers should also have to go through it. If I take this pain away, then the struggle and achievements of having mastered that concept also vanish.

You know... when I was your age we had to walk in the snow, up hill, both ways.

I don't believe nothis is for beginners or for experts. It's for all JavaScript developers. The tooling is just new and needs to be simplified further. And as a matter of fact I have a new React Component that I will release shortly that will do just that.

It will let you create a component like this:

class Counter extends NoThis.Component {
  state = { count: 0 }

  increment({ setState }) {
    setState(({ count }) => ({ count: count + 1 }))
  }

  render({ increment, state: { count } }) {
    return (
      <div>
        <button onClick={increment}>{count}</button>
      </div>
    )
  }
}

Now that is simple :D

Cheers!