In this blog post, I am going to briefly define closure and showcase how React hook UseState works under the hood.
We can think about it just like MDN defines it as the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). In other words, closure is when a function is able to remember its lexical scope even when that function is executing outside its lexical scope.
The word “lexical” refers to the fact that lexical scoping uses the location where a variable is declared within the source code to determine where that…
Hoisting is a JS default behavior of defining all the declarations at the top of the scope before code execution. Its main benefit is enabling us to call functions before they appear in the code.
I noticed during my first month of coding Vanilla JS that, not fully understanding the concept of hoisting could cause a lot of issues/bugs/errors down the road. Through this blog, I am going to explain what goes under the hood of JS hoisting.
There are two phases in…
Ruby on Rails or Rails is a user-friendly open source framework. Its main goal is to optimize the web application development process.
Rails developers must follow standard best practice conventions in order for the magic to happen. Rails is built on the principle of convention over configuration (for example: a model is singular — a controller is plural).
Generators are a nifty way of integrating standard features that help creating CRUD functionalities in an application. So instead of having to build them manually each time, Rails came out with a faster automated way. …