Rohit Kumar Dwivedi

Rohit Kumar Dwivedi

10 Articles Published

Articles by Rohit Kumar Dwivedi

10 articles

SQL Query to Get Column Names From a Table

SQL
Rohit Kumar Dwivedi
Rohit Kumar Dwivedi
Updated on 28-Jan-2025 346 Views

In this article, we are going to learn how to get column names from a table using an SQL query. If you don't know what SQL is, keep reading because everything is covered from scratch. SQL stands for Structured Query Language, which is used to interact with databases. Basically, queries are used to perform CRUD operations on databases. Steps to Retrieve Column Names Here is the step-by-step explanation of getting columns from a table. Step 1: Check Database First, check the database where the table exists. If the database does not exist, run the following query to create it. CREATE ...

Read More

Query to find 2nd largest value in a column in Table

SQL
Rohit Kumar Dwivedi
Rohit Kumar Dwivedi
Updated on 24-Jan-2025 746 Views

In this article, we will learn how to find the 2nd largest value in a column of a table. It’s a pretty common task when working with databases, especially when you need to analyze data. We will explore efficient methods to find the second-largest value using SQL queries, with step-by-step explanations and examples for better understanding. Steps to Retrieve 2nd Largest Value in a Column Here is the step-by-step explanation of getting 2nd largest value in a column in a table. Step 1: Check Database First, check the database where the table exists. If the database does not exist, run the ...

Read More

How to programmatically navigate using React Router?

Rohit Kumar Dwivedi
Rohit Kumar Dwivedi
Updated on 20-Dec-2024 290 Views

In this article, we will learn how to programmatically navigate using React Router. Programmatic navigation enables changing the URL of an application without reloading the page. We can use several approaches to programmatically navigate in a React application using React Router. Approaches to navigate using React Router To programmatically navigate a React application, we can use several methods based on the version of React Router. In React Router v6, the useNavigate hook is introduced, which is recommended for programmatic navigation. By calling the navigate function returned from useNavigate, we can navigate to other routes. In React Router v5, the ...

Read More

How to Redirect to Another Page in ReactJS?

Rohit Kumar Dwivedi
Rohit Kumar Dwivedi
Updated on 19-Dec-2024 447 Views

Redirecting is one of the vital features in frontend applications like React apps. Moving from one page to another is known as navigation. In React, navigation is important for maintaining a Single Page Application for a better user experience. react-router-dom is a npm package which enables dynamic routing in react application. In this article, we are going to learn how we can redirect from one page to another in ReactJS. Using React Router Dom Navigating to another page can be done efficiently with the help of react-router-dom. It is an npm package responsible for client-side navigation. Using React ...

Read More

How to pass data from child component to its parent in ReactJS?

Rohit Kumar Dwivedi
Rohit Kumar Dwivedi
Updated on 19-Dec-2024 362 Views

Passing data from one component to another is an essential part of building complex React applications. React props and states are fundamental concepts in React. Props stand for properties, which are used for passing data from one component to another, while State is used to manage data within a component. Prerequisites ReactJS Props ReactJS State Passing Data from Child Component to Parent You can easily pass data from a parent component to a child component with the help of props. Passing data from a child component to a ...

Read More

How to Loop inside React JSX?

Rohit Kumar Dwivedi
Rohit Kumar Dwivedi
Updated on 17-Dec-2024 331 Views

In this article, we are going to learn how to iterate on list or collection of data dynamically. However, directly using a loop is not a valid syntax in JSX. It is crucial to understand how to use loops inside React JSX. By iterating on arrays or any collections of data, we can render the component dynamically. Prerequisites ReactJS JSX Approaches to Loop inside React JSX The map() function and other methods can be used to repeat elements in JSX when we need to iterate over a list ...

Read More

Difference between npx and npm

Rohit Kumar Dwivedi
Rohit Kumar Dwivedi
Updated on 17-Dec-2024 205 Views

In this article, we’re going to discuss the differences between the npm and npx. The difference between npm and npx is that npm is a package manager for managing dependencies and npx is a tool that allows you to run Node.js packages directly without installing them. Both are related to node.js but they are used for different purposes. First, let’s understand what npm is. npm The npm stands for Node Package Manager. It is a default Javascript package manager for Node.js that allows developers to install, share and manage dependencies. NPM is installed when NodeJS is installed on system. ...

Read More

How to Fix React useEffect running twice in React 18?

Rohit Kumar Dwivedi
Rohit Kumar Dwivedi
Updated on 17-Dec-2024 332 Views

In this article, we will cover why React 18's useEffect runs twice and how to handle this. If you recently switched your React application to version 18, you might have noticed that useEffect runs twice during component mounting. React 18 introduces a new development-only check called Strict Mode. This new check will automatically unmount and remount every component. Let's dive deeper into why this happens. Why useEffect runs twice? In React 18, when you are in development mode, your application runs in StrictMode by default. In StrictMode, React mounts, unmounts, and remounts components. It helps developers identify bugs and unexpected ...

Read More

Difference between state and props in React

Rohit Kumar Dwivedi
Rohit Kumar Dwivedi
Updated on 17-Dec-2024 481 Views

In this article, we will learn about the differences between state and prop. props stands for properties and provides the way to pass the data from one component to another while state is like a variable to store data. Props are immutable because it can't be changed while State is mutable because we can change them easily. Understanding the concept of state and prop for building reusable and maintainable applications is necessary. ReactJS Props Props are the objects used to pass the data from one component to another. It is the abbreviation for Properties. Prop is the read-only ...

Read More

How to Show or Hide Element in React?

Rohit Kumar Dwivedi
Rohit Kumar Dwivedi
Updated on 16-Dec-2024 352 Views

In this article, we are going to cover the implementation of dynamically showing or hiding elements in React. To understand this concept, you must be familiar with hooks in React. By leveraging hooks like useState, you can toggle and update the state to effectively control the visibility of an element. Approaches to Show or Hide Elements in React Using && Operator Using return null Using && Operator We have to change the state when a button is clicked, then it will determine the visibility of the element. With ...

Read More
Showing 1–10 of 10 articles
« Prev 1 Next »
Advertisements