DEV Community

Cover image for What’s new in React?
Priyadarshini Sharma
Priyadarshini Sharma

Posted on

What’s new in React?

React is a continuously evolving library in the ever-changing web development landscape. As you embark on your journey to learn and master React, it’s important to understand the evolution of the library and its updates over time.

One of the advantages of React is that its core API has remained relatively stable in recent years. This provides a sense of continuity and allows developers to leverage their knowledge from previous versions. The conceptual foundation of React has remained intact, meaning that the skills acquired three or five years ago can still be applied today. Let’s take a step back and trace the
history of React from its early versions to the recent ones. From React 0.x to React 18, numerous pivotal changes and enhancements have been made as follows:

  1. React 0.14: In this version, the introduction of functional components allowed developers to utilize functions as components, simplifying the creation of basic UI elements. At that time, no one knew that now we would write only functional components and almost completely abandon class-based components.
  2. React 15: With a new versioning scheme, the next update of React 15 brought a complete overhaul of the internal architecture, resulting in improved performance and stability.
  3. React 16: This version, however, stands as one of the most notable releases in React’s history. It introduced hooks,a revolutionary concept that enables developers to use state and other React features without the need for class components. Hooks make code simpler and more readable, transforming the way developers write components.Additionally, React 16 introduced Fiber, a new reconciliation mechanism that significantly improved performance, especially when dealing with animations and complex UI structures.
  4. React 17: This version focused on updating and maintaining compatibility with previous versions. It introduced a new JSX transform system.
  5. React 18: This is the latest stable release, which continues the trajectory of improvement and emphasizes performance enhancements and additional features, such as the automatic batching of renders, state transitions, server components, and streaming server-side rendering.

Setting up a new React project
There are several ways to create a React project when you are getting started. In this section, let's explore three common approaches:
• Using web bundlers
• Using frameworks
• Using an online code editor

Using web bundlers
Using a web bundler is an efficient way to create React projects, especially if you are building a Single-Page Application (SPA). Vite is known for its remarkable speed and ease of setup and use.

To set up your project using Vite, you will need to take the following steps:

  1. Ensure that you have Node.js installed on your computer by visiting the official Node.js website [https://nodejs.org/en] and downloading the appropriate version for your operating system.
  2. Open your terminal or command prompt and navigate to the directory where you want to create your project:

Image description

  1. Run the following command to create a new React project with Vite

Image description

  1. Once the project is created, your terminal should look like this:

Image description

  1. Navigate into the project directory and install dependencies. The result in the terminal should look like

Image description
Finally, start the development server by running the following command: npm run dev.This command launches the development server, and you can view your React application by opening your browser and visiting http://localhost:3000

Using frameworks
For real-world and commercial projects, it is recommended to use frameworks built on top of React. These frameworks provide additional features out of the box, such as routing and asset
management (images, SVG files, fonts, etc.). They also guide you in organizing your project structure effectively, as frameworks often enforce specific file organization rules. Some popular React
frameworks include Next.js, Gatsby, and Remix.

Online code editors
Online code editors combine the advantages of web bundlers and frameworks but allow you to set up your React development environment in the cloud or right inside of the browser. This
eliminates the need to install anything on your machine and lets you write and explore React code directly in your browser.
While there are various online code editors available, some of the most popular options include CodeSandbox, StackBlitz, and Replit. These platforms provide a user-friendly interface and allow you to create, share, and collaborate on React projects without any local setup.To get started with an online code editor, you don’t even need an account. Simply follow this link
on your browser:(https://codesandbox.io/p/sandbox/react-new?utm_source=dotnew). In a few seconds, you will see that CodeSandbox is ready to work with a template project, and a live preview of the editor is available directly in the browser tab. If you want to save your changes, then you need to create an account.Using online code editors is a convenient way to learn and experiment with React, especially if you prefer a browser-based development environment.

Reference material : React and React Native

Top comments (0)