Reactgo
1,515 FOLLOWERS
Tutorials about modern JavaScript such as React, Vuejs, Angular, Algorithms, and all things related to Web development.
Reactgo
3w ago
In this tutorial, we will learn how to remove a git repository which is created by using the git init command.
Removing a Git repository
We can remove a git repository by deleting the .git folder because git keeps all information inside that folder.
Here is an example:
In your terminal navigate to git repository you need to remove.
Now, run the following command to delete the .git folder.
rm -rf .git ..read more
Reactgo
3w ago
In this tutorial, we will learn how to send the authorization header to an API using Axios.
What is Authorization Header?
Authorization header is used to authenticate the user agent with a server.
When we login into a website or app, the server will send a Jwt token or some type of token which is used to send in Authorization header, to make a request for the protected routes.
Sending authorization header
To send an authorization header, we need to add a Authorization property with a token value to the headers object.
Here is an example, that sends the authorization header to HTTP GET reques ..read more
Reactgo
3w ago
In this tutorial, we are going to learn about how to use the splice() and slice() methods in JavaScript with the help of examples.
Splice method
The splice() method helps us to remove the elements from the existing array and also insert the new elements in the place of removed elements.
splice method accepts three arguments.
start: In which index we need to start removing elements from the array.
deleteCount: how many elements we need to remove from the array.
item1, item2(optional): insert the new elements in the place of removed elements.(if you don’t specify new elements splice method will ..read more
Reactgo
2M ago
In this tutorial, we are going to learn about how to get the length of a Vector in Rust language.
The length of a vector means the total number of elements present in a given vector.
In Rust, vectors are used to store the data of same datatype.
Getting the vector length
To get the length of a vector, we can use the built in len() method in Rust.
Here is an example, that gets the length of a vector stored in the price variable.
let mut price = vec![4, 5, 6, 7];
println!("Length is: {}", price.len())
Output:
Length is 4 ..read more
Reactgo
2M ago
In this tutorial, we are going to learn about how to concatenate the arrays in Ruby with the help of examples.
Concatenation means the joining of two or more arrays into a single array.
Consider, we have the following two arrays:
prices = [3, 4, 5]
fruits = ["apple", "bananna", "grapes"]
Now, we need to join above two arrays like this:
[3, 4, 5, "apple", "bananna", "grapes"]
Using the plus ”+” operator
To concatenate the two arrays into a single array, we can use the plus operator + in Ruby.
Here is an example:
prices = [3, 4, 5]
fruits = ["apple", "bananna", "grapes"]
result = prices ..read more
Reactgo
2M ago
In this tutorial, we are going to learn about how to sort a vector in R language with the help of examples.
To sort a vector in R language, we can use the built-in sort() function.
The sort() function takes the vector as an argument and returns the sorted items in ascending order for strings it will return alphabetical order.
Here is an example, that sorts the vector of numbers in ascending order :
# vector of numbers
prices = c(5, 3, 6, 2)
result = sort(prices)
print(result)
Output:
[1] 2 3 5 6
In the example above, we have sorted the vector of numbers in ascending order.
To sort a vec ..read more
Reactgo
2M ago
In this tutorial, we are going to learn about how to add images and background images in the react app with the help of examples.
Adding images to components
In react components, we can import images just like JavaScript modules where webpack includes that image file in a bundle and returns the final path of an image.
Example:
App.js
import React from 'react';
import car from './images/car.jpg'; // gives image path
function App(){
return(
<div>
<img src={car} alt="this is car image" /> </div>
)
}
export default App;
To reduce network re ..read more
Reactgo
2M ago
In the last tutorial, we have seen how to make http requests in vuejs using vue-resource, In this tutorial, we are going to learn about interceptors in vue.js.
Interceptors
Interceptors help us to pre or post-processing a request, it means we can modify the requests before it sent to the server or we can modify the responses coming back from the request.
Interceptors are defined globally.
Intercepting a request
We are using vue-resource http client package for intercepting requests in vuejs.
Example:
main.js
import Vue from "vue";
import App from "./App.vue";
import VueResource from 'vue-res ..read more
Reactgo
2M ago
In this tutorial, we are going to learn about how to set a focus to a input element when a component is rendered into the dom.
If we open a Google.com the input element is focused automatically and we can start typing without any button click.
Let’s learn how we can do it in react apps.
In react, we have the ComponentDidMount() lifecycle method where it runs when a component is mounted to the dom tree.
The ComponentDidMount() method is the best place to set a focus on the input element.
Let’s see an example:
App.js
import React,{Component} from 'react';
class App extends Component {
compo ..read more
Reactgo
2M ago
In this tutorial, we are going to learn about how to access the elements from a Vector in R with the help of examples.
A vector is a collection of elements that are of same data type. To combine the list of elements in vector we can use the c() function in R.
The c() function takes the list of elements that are strings or numbers , etc as an arguments and create a vector.
Here is an example, a vector of strings:
# vector of strings
fruits = c("apple", "bannana", "grapes")
# print the vector
fruits
Accessing the elements from a Vector
To access the individual elements from a vector, we can ..read more