DEV Community

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

Collapse
 
hutber profile image
Jamie Hutber

Having gone through the comments there seems to be a lot of bashing, which you don't seem to comfortable with OP. It's never easy to take criticism. I'd just say thanks for trying to fix holes where you see them.

For what it's worth I think that actually this kind of package should be targeted to more senior Devs rather than junior. In as much that. If I didn't get caught out by this in the early days so very much then I never ever would have had to read abs learn about this. I do believe if people were to use this they would then have no idea what this is actually doing.

Then you'd just have to justify to seniors why use this, less writing might be the way to go.

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!