nguyenlan13.github.io


Lifecycle Methods

The react component lifecycle consists of three phases, creation (mounting), updating, and deletion(unmounting). To control how a component responds to a change, we can use lifecycle methods.


JavaScript Variable Declaration

Prior to ES6, variables were declared with Var. Since the JavaScript engine works in two phases, first the complilation phase and then the execution phase, depending on where the variable was declared could cause issues with hoisting. Hoisting occurs when a variable can be used before declaring it. Hoisting applies to variable declarations but not its assignments. Hoisting allows this to work:


Object Relations

``` class Recipe


Require and Require Relative

When setting up the environment and bin files, require is a method that takes in a file name to load, the file must be in the project directory where the application is being run. When using require_relative, the required files will always be located relative to where the file that is calling require_relative is located.


Self in Ruby

In Ruby, everything is an object. Self in Ruby always refers to the current object, regardless of context. The context in which self is used will determine the meaning.