React

React: How to Render an Array of Objects (Full Example)

Updated: March 3, 2023 By: A Goodman

In React, the most popular way to render an array of objects is to use the Array.map() method. This method calls a function once for each element in the array: The complete example below will give…

React: 5+ Ways to Store Data Locally in Web Browsers (2024)

Updated: January 24, 2024 By: Guest Contributor

This article walks you through a list of the most popular and modern approaches to persist data locally in React. Some of them are easy to use and great for a small amount of simple data,…

React: How to Detect a Click Outside/Inside a Component

Updated: March 3, 2023 By: A Goodman

This concise and straight-to-the-point article shows you the fastest and easiest way to detect if the user clicks somewhere outside a specific component in a React application. We’ll discuss the technique to get the job done…

How to Change the Base Path in React

Updated: March 3, 2023 By: A Goodman

This short and straight-to-the-point article shows you how to set a base path for a React app created with create-react-app and using React Router. The Prefatory Matter There might be situations where you want to run…

Using Radio Buttons in React

Updated: March 3, 2023 By: A Goodman

This concise and straight-to-the-point article shows you how to use radio buttons in React. We’ll have a look at the fundamentals and then walk through a complete example of applying that knowledge in practice. Note: We’ll…

React: Check if user device is in dark mode/light mode

Updated: March 3, 2023 By: A Goodman

This succinct and straight-to-the-point article shows you how to check whether the user’s system is in dark mode or light mode. Knowing that thing can help your React app automatically change its color scheme to suit…

React: How to Create a New Project in the Current Directory

Updated: March 3, 2023 By: A Goodman

If you’re using create-react-app then you can initialize a new project in the current directory with one of the following commands: Or: The point here is to use a dot (.) to set the path. There…

How to Use Styled JSX in React: A Deep Dive

Updated: March 3, 2023 By: A Goodman

This comprehensive article shows you how to use Styled JSX in a React application created by create-react-app. Overview Before using styled JSX, you need to install the styled-jsx package: No extra configuration is required for the…

React Router: Redirecting with the Navigate component

Updated: March 3, 2023 By: A Goodman

In this article, we’ll explore the fundaments of the <Navigate> component in React Router and then walk through a complete example of using it in practice. We’ll use the latest version of React Router (6.x) and…

React: 2 Ways to Open an External Link in New Tab

Updated: March 3, 2023 By: A Goodman

This article shows you two different ways to open an external link in a new browser tab in React. The first approach uses <a> tag, which is simple and quick but has some limitations. The second…

How to Use Tailwind CSS in React

Updated: March 3, 2023 By: Pennywise

Tailwind is a popular open-source CSS framework that can help you rapidly build user interfaces. It works very nicely with React and you can style your apps without leaving your Javascript (or TypeScript) code, thanks to…

React Router: useParams & useSearchParams Hooks

Updated: March 3, 2023 By: A Goodman

This article is about the useParams and useSearchParams hooks that come with React Router. We’ll cover the fundamentals of these hooks and then walk through a complete example of using them in practice. Note: We’ll use…

1 2 3 4 5 6 11