Using a simple counter form to go over this concept
I will assume before jumping into this topic that you have worked with React before and know at least some of it!
We have built applications with React, but often times we do not question why and how these things are happening.
Using React Hooks, I have built a simple React Counter App.
import React, { useState } from 'react';
import ReactDOM from 'react-dom';const App = ()=>{const [count, setCount] = useState(0)let add = (evt) => {
setCount(count + 1)
}let substract = () =>{ setCount(count …
Integrating Zomato API step by step process.
When I was a Software Engineering Bootcamp Student, I had a hard time incorporating external APIS to my Rails App. It required me to read the documentation, get the API key, and what not! Oh well, that's every engineer’s life. Without wasting time lets get started:
Objective: Send a request to fetch all the cuisines associated with the specific city.
Things we need:
$ rails new my_api…
Oh well! It did take me a while to wrap my head around how Javascript, being a single-threaded language (meaning it has only one execution path), handles asynchronous calls. Asynchronous Behaviour is possible through Callback Queue! I will be explaining this in a bit.
A Closure is a simple concept that returns a function inside another function. Also, remember functions are first-class citizens meaning one function can be inside another function. Functions in closure come with a backpack!
Whenever the inner function is called, it will always look for variables in the backpack or also known as Persistent Lexical Scope ( The scope of the functions depends on where it has been declared not executed). …
There are many array methods in Javascript but the one with which I struggle the most is, .splice() method.
So the other day, I came across a leet code problem, which asked me to manipulate an array without making a copy of it! I searched for methods and I remembered, that .splice() can be useful for this problem. So without wasting any time lets dive into the basics of .splice() method.
Deleting A Number from an Array let array = [2,3,4,5,6] //At index 0, let's delete the first number which is 2 in this case! array.splice(0, 1) ==> return…
Why do we need redux?
Redux is a predictable state container for Javascript applications, as mentioned in redux documentation. It took me some time to get my head around this concept. What does it actually mean? Let’s break this down into three points and focus on each of them separately. Redux is for:
This simply means Redux can be used with any frameworks such as React, Angular, Vanilla Javascript, etc. It can be used independently and is not tied together to react.
2. It is a State Container
It stores the state of the application as a single…
What are “props” and how do we really use it? Assuming, we all know about react Components, which are reusable, meaning they can return any JSX, which can be included in any part of our application. Let's build a simple app whose only job is to welcome a user by their name.
Here the parent is App.js, which is a class component, and its child Welcome.js is a functional component.
//this is App.jsimport React, { Component } from 'react';
import Welcome from './Welcome.jsx';class App extends Component { render() {
return (
<div>
<Welcome/>
<Welcome/>
</div>
);
}
}…
Before understanding how looping works, let us talk about JavaScript Objects. Remember, when we declare a variable using let, const, or var keywords? We set the identifier or variable name equals to a value. JavaScript variable can contain only one value, for example:
let fruit = "apple";
Where the fruit is the identifier or name of the variable and apple is the value. Let’s say, we bought some fresh fruits from the farmer’s market. How can we save all the fruits and fruit count into one variable? Yes, you guessed it right! We can use objects because they can contain…
When I started working on my first CLI project, I encountered many errors and spent most of my time debugging, which is good because I have read somewhere that “Only half of programming is coding. The other 90% is debugging.” After digging through ruby docs, I found out about these useful keywords, begin and rescue.
Let me give you a refresher! Keywords or reserved words are used by a language for internal processes and therefore cannot be used as a variable.
For example:
#'if' and 'end' are keywords to check the condition of a given code. …
Coach @FlatironSchool