Categories
reactjs

✨Top resources to learn React.js [in no particular order]

Hey everyone 👋🏻,

I recently wrote an article where I mentioned about React Projects Every Beginner Should Try : https://dev.to/thenerdydev/10-react-projects-every-beginner-should-try-fk9.

In this article, I will be mentioning the top 5 resources that I highly recommend if you want to learn React.js.

PS : I am not an affiliate of any of these resources/courses. These are just some of my personal recommendations if you are looking to learn React.

Introduction

Image description


React.js is a frontend JavaScript library for building amazing, sleek and performant user interfaces specifically for single page applications a.k.a SPAs. It is used for handling the view layer for web and mobile apps. React allows us to compose the entire user interface using the basic building blocks that are called as components.

Here are the top 5 recommendations (in no particular order) of the courses that you should definitely check out for learning React.

1. Build Web Apps with React & Firebase by Shaun Pelling a.k.a The Net Ninja (rated 4.8)

Image description

Shaun is a gifted teacher. He knows how to explain stuff in a very easy and lucid manner. This course will definitely take your knowledge to the next level if you are looking to learn this specific technology.

Here is what this course covers

Learn how to create modern & dynamic React websites from the ground up

Learn how to implement a database, authentication & file uploads with React & Firebase

Learn about Components, Props, Hooks, Context, State, Reducers & the React Router

Create & deploy fully fledged user-based React websites

Course Link :

https://www.udemy.com/course/build-web-apps-with-react-firebase/

2. React.js – The Complete Guide by Maximilian Schwarzmuller ( rated 4.6)

Image description

This course as the name can probably tell you covers the internals of React in great detail. The course starts from the very basics like What React.js is and how it works and later on moves to more complex and advanced topics

Here is what this course covers

A thorough introduction to React.js (What is it and why would you use it?)

All the core basics: How React works, building components with React & building UIs with React

Components, props & dynamic data binding

Working with user events and state to create interactive applications

A (thorough) look behind the scenes to understand how React works under the hood

Detailed explanations on how to work with lists and conditional content

React Hooks (in-depth)!

Working with built-in Hooks and building custom Hooks

How to debug React apps

Styling React apps with “Styled Components” and “CSS Modules”

Working with “Fragments” & “Portals”

Dealing with side effects

Class-based components and functional components

Sending Http requests & handling transitional states + responses

Handling forms and user input (incl. validation)

Redux & Redux Toolkit

Routing with React Router

An in-depth introduction into Next.js

Deploying React Apps

Implementing Authentication

Unit Tests

Combining React with TypeScript

Adding Animations

Tons of examples and demo projects so that you can apply all the things you learned in real projects

and more …

Course Link :

https://www.udemy.com/course/react-the-complete-guide-incl-redux/

3. Complete React Developer in 2022 (w/ Redux, Hooks, GraphQL)

Become a Senior React Developer! Build a massive E-commerce app with Redux, Hooks, GraphQL, ContextAPI, Stripe, Firebase. This course is created by two instructors – Andrei Neagoie and Yihua Zhang who have working experience with some of the best US Startups and big companies.

Image description

Here is what this course covers

React Basics

– React Router

– Redux

– Redux Saga

– Asynchronous Redux

– React Hooks

– Context API

– React Suspense + React Lazy

– Firebase

– Stripe API

– Styled-Components

– GraphQL

– Apollo

– PWAs

– React Performance

– React Design Patterns

– Testing with Jest, Enzyme and Snapshot testing

– React Best Practices

– Persistence + Session Storage

– State Normalization

Course Link :

https://www.udemy.com/course/complete-react-developer-zero-to-mastery

4. React.js Documentation (a must thing to refer)

Image description

Docs link :

https://reactjs.org/docs/getting-started.html

So this is it for this article. Thanks for reading.
Don’t forget to leave a like if you loved the article. Also share it with your friends and colleagues.

Categories
frontend javascript web development

JavaScript methods for finding elements

Hey guys,

Welcome back to a new article !

In this article, we will learn about different JavaScript methods that we can make use of for finding elements in an array. Arrays, as we know, is a data structure that is one of the key building blocks that we make use of for building data-based intensive web applications. With an array, we can easily store and manipulate elements within the array as and how we want to. Let us see the 4 methods that you can make use of for finding an element in an array.


find

The find() method returns the first element in the provided array that satisfies the provided testing function. So we specify a testing function as the callback and the find method will return the first item that returns true for the condition that we test within the specified callback. If no elements satisfy the testing function, then undefined gets returned. Let us see an example for the find method.

const numbers = [5, 12, 8, 130, 44];

const firstNumberGreaterThan10 = numbers.find(element => element > 10);

console.log(firstNumberGreaterThan10 );
// expected output: 12

findIndex

The findIndex() method returns the index of the first element in the array that satisfies the provided testing function. So as a testing function, we pass a callback to the findIndex method and there we explicitly mention a condition and based on the truthiness of that condition, we get an element that satisfies that specified condition. In case, no element passes the testing condition then it returns -1.

const numbers = [1, 3, 4, 6, 10];

const greaterIndex = numbers.findIndex(element => element > 6); 
console.log(greaterIndex); // 4

const smallerIndex = numbers.findIndex(element => element > 10); 
console.log(smallerIndex); // -1 

Consider the above example in which we have a list of numbers that is given to us, let us say we want to find the index of the first occurrence of an element which is greater than 6. So for this case, we can make use of the findIndex method with the testing condition as element > 6. Next, let us say we want to find the index of the first occurrence of an element which is greater than 10. So we again make use of the findIndex method with the testing condition as element > 10. Now since there is no element that satisfies the above condition, hence we get a -1 for this.


indexOf

The indexOf() method returns the index of the first occurrence of the substring or element that we specify as the argument.

Let us see an example for the indexOf method, let us say we are given an array of elements and we want to find the index of some elements within that array. So see the below code :

const numbers = [1, 3, 4, 6, 10];

const indexOf10 = numbers.indexOf(10); // 4

const indexOf16 = numbers.indexOf(16); // -1

So if we try to search the index of the number 10 in the given array of numbers, then we get 4 because 10 is sitting at index 4 of the given array. Next, for the number 16 we get -1 because the number 16 is not present anywhere within the given array.


lastIndexOf

The lastIndexOf() method returns the index of the last occurrence of the specified substring or element that we specify as argument. The lastIndexOf method is similar to the indexOf method that we just discussed but the only difference being that it starts to look up from the trailing end of the array instead of the start of the array like we do in indexOf. So in essence, if you know for sure that the element that you are looking for lies in the latter half of the array, then using the lastIndexOf method makes more sense.

const numbers = [1, 3, 4, 6, 10];

const indexOf10FromLast = numbers.lastIndexOf(10); 

console.log(indexOf10FromLast); // 4

const indexOf16FromLast = numbers.lastIndexOf(16); 

console.log(indexOf16FromLast); // -1

So in above example, if we try to find the index of the last occurrence of a particular element, say 10, then we get 4. Since, 10 is present at index 4 and we only have one occurrence of 10 in the numbers array. Next, 16 is not present anywhere in the array so for that if we try to find the last occurrence of it using the lastIndexOf method, we get -1.


So this is it for this article. Thanks for reading.

Categories
Uncategorized

Literals, Variables and Constants in C++

Variables, Literals and Constants in C++

In this tutorial, let us learn about variables, literals, and constants in C++ with help of some examples. So let us learn first what a variable is in C++.

C++ Variables

In programming, a variable is defined as a container that is used to store data. So it is used to store some information that we can later on reference and manipulate in our code.

So to create a variable, we first need a unique name for the variable. This unique name for the variable is also called as the identifier. So let us see some examples on how we can create and initialize variables in C++.

int age = 23; 
char b = 'a'

Here, age is a variable of the int data type, and to it we have assigned a value of 23. Next we have b which is a variable of the char data type and to it we have assigned some character data which in this case is ‘a’.

Note: One thing to note here is that a variable with the int data type can only hold integers. Similarly, a variable with the char data type can only hold data of character type. If we want to store decimals and exponentials, we can make use of the double data type.

Another thing to note here is that the variables are mutable in the sense that you can reassign the variable to difference values and hence this implies that you can change the content of a variable.

Let us also see an example for this :

int age = 23;   // initially age is set to 23
age = 29;       // reassigning the age to a new value of 29

Rules for naming a variable

  • A variable name can only have alphabets, numbers, and the underscore _.
  • A variable name cannot begin with a number.
  • It is a preferred practice to begin variable names with a lowercase character. For example, name is preferable to Name.
  • A keyword cannot be used as a variable name. For example, a keyword like int cannot be used as a variable name.
  • A variable name can start with an underscore. Also ensure that you give meaningful names to your variables which semantically makes sense.


C++ Literals

Literals are data used for representing fixed values. They can be used directly in the code. So in essence, these are source code representation of a fixed value or a sequence of characters which represents a constant value that is to be stored inside a variable.

For example: 156.5'z' etc.

Now these are called literals because you cannot assign a different value to these terms. Here is a list of different literals that we have in C++ Programming :


1. Integers

According to Wikipedia,

 An integer is a datum of integral data type, a data type that represents some range of mathematical integers. Integral data types may be of different sizes and may or may not be allowed to contain negative values. Integers are commonly represented in a computer as a group of binary digits (bits)

This means that an integer is a numerical literal that does not have any fractional or exponent within it. There are three types of integer literals in C Programming :

  • decimal (base 10)
  • octal (base 8)
  • hexadecimal (base 16)

For example:

Decimal: 0, -21, 46 etc
Octal: 02, 786 etc
Hexadecimal: 0x3f,  0x421 etc

A thing to note here is that an octal starts with a 0 and a hexadecimal starts with a 0x.


2. Floating-point Literals

Floating-point literals are numbers that have a decimal point or an exponential part. They can be represented as: Real literals. Binary floating-point literals.

-2.0

0.0000234

-0.22E-5

Note: E-5 = 10-5


3. Characters

A character literal is a type of literal in programming for the representation of a single character’s value within the source code of a computer program. It is represented by enclosing a single character inside single quotes. For example : 'b', 'f', 'G', '21', '}' etc.


4. Escape Sequences

 An escape sequence is a combination of characters that has a meaning other than the literal characters contained therein; it is marked by one or more preceding characters

Here is a lit of escape sequences for the given characters :

Escape SequencesCharacters
\bBackspace
\fForm feed
\nNewline
\rReturn
\tHorizontal tab
\vVertical tab
\\Backslash
\'Single quotation mark
\"Double quotation mark
\?Question mark
\0Null Character

5. String Literals

A string literal is a sequence of characters enclosed in double-quote marks. For example:

"This is a string"create a string
""empty string
" "string with a whitespace in quotes.
"x"a single character enclosed within quotes.
"This is a string\n"prints a string with a newline

We will also learn about Strings in a separate article as well. Let us now move forward to constants in C++.


C++ Constants

The value of a constant never changes once defined, so kind of it is immutable and cannot be re-assigned once a value has been fixed for a constant.

const int PI = 3.14;
PI = 3.233 // Error! PI is a constant.

See the above example here we have used the const keyword to declare a constant which we have named PI. Now if we try to mutate or change the value of PI,we will get an error because we cannot reassign a variable that we have declared using the const keyword. If we do so, we will get an error.

We can also create a constant using the #define preprocessor directive, something that we will learn about in a separate article.