Smith-Steve / Drip-Email-System

A Full Stack JavaScript/React.js || Node.js || PostgreSQL solo project created for users who wish to send customized emails to contacts in groups.
https://drip-email-system.herokuapp.com/
1 stars 0 forks source link

Refactor: Tim D. Code Review - Cleanup #101

Open thebearingedge opened 3 years ago

thebearingedge commented 3 years ago

Hi Steve, here's a code review as we discussed via Slack. I'll do a separate UI review. The cleanup should come first as it's much easier to make behavioral and visual changes to the code when the code is clean. In some cases, I point to specific lines of code, but you should be looking out for these issues throughout the entire code base.

As always, make sure you test your app after each change to confirm that it still works as expected. Also commit after each change.

✅ Task List

Check list items that need to be done in order to complete the refactor.
Smith-Steve commented 3 years ago

@thebearingedge

Tim, I have double checked this and have gotten everything. A question for you. I'm going to Slack this to you as well.

  1. On check mark 8, you said "You seemingly use a random mix of property initilizers ....". I was using the arrow methods that I did not intend on using outside of the component in question. Beyond that, it is true that there was no rhyme or reason to why I was using bound prototype methods over arrow functions. What is this not reason enough?
thebearingedge commented 3 years ago

@Smith-Steve Hi Steve! The methods of your components are generally only going to be calling each other or called by the React framework. The main reason to choose an "arrow method" is to avoid having to bind it in your constructor. The JavaScript engine interprets them as follows.

This is what you write:

class Example {
  constructor() {

  }
  aMethod = () => {
  }
}

And this is how the JavaScript engine interprets it:

class Example {
  constructor() {
    this.aMethod = () => {
    }
  }
}

It's a new language feature that is very near being official, but it's not quite there yet. It's at stage 3 of the proposal process.

https://github.com/tc39/proposal-class-fields