Start a New React Project – React (2024)

If you want to build a new app or a new website fully with React, we recommend picking one of the React-powered frameworks popular in the community. Frameworks provide features that most apps and sites eventually need, including routing, data fetching, and generating HTML.

Note

You need to install Node.js for local development. You can also choose to use Node.js in production, but you don’t have to. Many React frameworks support export to a static HTML/CSS/JS folder.

Production-grade React frameworks

Next.js

Next.js is a full-stack React framework. It’s versatile and lets you create React apps of any size—from a mostly static blog to a complex dynamic application. To create a new Next.js project, run in your terminal:

Terminal

npx create-next-app@latest

If you’re new to Next.js, check out the learn Next.js course.

Next.js is maintained by Vercel. You can deploy a Next.js app to any Node.js or serverless hosting, or to your own server. Next.js also supports a static export which doesn’t require a server.

Remix

Remix is a full-stack React framework with nested routing. It lets you break your app into nested parts that can load data in parallel and refresh in response to the user actions. To create a new Remix project, run:

If you’re new to Remix, check out the Remix blog tutorial (short) and app tutorial (long).

Remix is maintained by Shopify. When you create a Remix project, you need to pick your deployment target. You can deploy a Remix app to any Node.js or serverless hosting by using or writing an adapter.

Gatsby

Gatsby is a React framework for fast CMS-backed websites. Its rich plugin ecosystem and its GraphQL data layer simplify integrating content, APIs, and services into one website. To create a new Gatsby project, run:

Terminal

npx create-gatsby

If you’re new to Gatsby, check out the Gatsby tutorial.

Gatsby is maintained by Netlify. You can deploy a fully static Gatsby site to any static hosting. If you opt into using server-only features, make sure your hosting provider supports them for Gatsby.

Expo (for native apps)

Expo is a React framework that lets you create universal Android, iOS, and web apps with truly native UIs. It provides an SDK for React Native that makes the native parts easier to use. To create a new Expo project, run:

Terminal

npx create-expo-app

If you’re new to Expo, check out the Expo tutorial.

Expo is maintained by Expo (the company). Building apps with Expo is free, and you can submit them to the Google and Apple app stores without restrictions. Expo additionally provides opt-in paid cloud services.

Deep Dive

Can I use React without a framework?

You can definitely use React without a framework—that’s how you’d use React for a part of your page. However, if you’re building a new app or a site fully with React, we recommend using a framework.

Here’s why.

Even if you don’t need routing or data fetching at first, you’ll likely want to add some libraries for them. As your JavaScript bundle grows with every new feature, you might have to figure out how to split code for every route individually. As your data fetching needs get more complex, you are likely to encounter server-client network waterfalls that make your app feel very slow. As your audience includes more users with poor network conditions and low-end devices, you might need to generate HTML from your components to display content early—either on the server, or during the build time. Changing your setup to run some of your code on the server or during the build can be very tricky.

These problems are not React-specific. This is why Svelte has SvelteKit, Vue has Nuxt, and so on. To solve these problems on your own, you’ll need to integrate your bundler with your router and with your data fetching library. It’s not hard to get an initial setup working, but there are a lot of subtleties involved in making an app that loads quickly even as it grows over time. You’ll want to send down the minimal amount of app code but do so in a single client–server roundtrip, in parallel with any data required for the page. You’ll likely want the page to be interactive before your JavaScript code even runs, to support progressive enhancement. You may want to generate a folder of fully static HTML files for your marketing pages that can be hosted anywhere and still work with JavaScript disabled. Building these capabilities yourself takes real work.

React frameworks on this page solve problems like these by default, with no extra work from your side. They let you start very lean and then scale your app with your needs. Each React framework has a community, so finding answers to questions and upgrading tooling is easier. Frameworks also give structure to your code, helping you and others retain context and skills between different projects. Conversely, with a custom setup it’s easier to get stuck on unsupported dependency versions, and you’ll essentially end up creating your own framework—albeit one with no community or upgrade path (and if it’s anything like the ones we’ve made in the past, more haphazardly designed).

If you’re still not convinced, or your app has unusual constraints not served well by these frameworks and you’d like to roll your own custom setup, we can’t stop you—go for it! Grab react and react-dom from npm, set up your custom build process with a bundler like Vite or Parcel, and add other tools as you need them for routing, static generation or server-side rendering, and more.

Bleeding-edge React frameworks

As we’ve explored how to continue improving React, we realized that integrating React more closely with frameworks (specifically, with routing, bundling, and server technologies) is our biggest opportunity to help React users build better apps. The Next.js team has agreed to collaborate with us in researching, developing, integrating, and testing framework-agnostic bleeding-edge React features like React Server Components.

These features are getting closer to being production-ready every day, and we’ve been in talks with other bundler and framework developers about integrating them. Our hope is that in a year or two, all frameworks listed on this page will have full support for these features. (If you’re a framework author interested in partnering with us to experiment with these features, please let us know!)

Next.js (App Router)

Next.js’s App Router is a redesign of the Next.js APIs aiming to fulfill the React team’s full-stack architecture vision. It lets you fetch data in asynchronous components that run on the server or even during the build.

Next.js is maintained by Vercel. You can deploy a Next.js app to any Node.js or serverless hosting, or to your own server. Next.js also supports static export which doesn’t require a server.

Deep Dive

Which features make up the React team’s full-stack architecture vision?

Next.js’s App Router bundler fully implements the official React Server Components specification. This lets you mix build-time, server-only, and interactive components in a single React tree.

For example, you can write a server-only React component as an async function that reads from a database or from a file. Then you can pass data down from it to your interactive components:

// This component runs *only* on the server (or during the build).

async function Talks({ confId }) {

// 1. You're on the server, so you can talk to your data layer. API endpoint not required.

const talks = await db.Talks.findAll({ confId });

// 2. Add any amount of rendering logic. It won't make your JavaScript bundle larger.

const videos = talks.map(talk => talk.video);

// 3. Pass the data down to the components that will run in the browser.

return <SearchableVideoList videos={videos} />;

}

Next.js’s App Router also integrates data fetching with Suspense. This lets you specify a loading state (like a skeleton placeholder) for different parts of your user interface directly in your React tree:

<Suspense fallback={<TalksLoading />}>

<Talks confId={conf.id} />

</Suspense>

Server Components and Suspense are React features rather than Next.js features. However, adopting them at the framework level requires buy-in and non-trivial implementation work. At the moment, the Next.js App Router is the most complete implementation. The React team is working with bundler developers to make these features easier to implement in the next generation of frameworks.

Start a New React Project – React (2024)

FAQs

How do I start a React build project? ›

Steps to Build React App with Create React App
  1. Step 1: Install Create React App. ...
  2. Step 2: Overview of React App Structure. ...
  3. Step 3: Starting the React App Development Server. ...
  4. Step 4: Using the React Testing Library to Run Tests. ...
  5. Step 5: Modifying the Meta Data for the App. ...
  6. Step 6: Using Assets like Images.
Jun 16, 2024

How do I start an existing React project? ›

To run an existing react app, clone or download the app's repository, navigate to the app's directory in the terminal, and run npm install to install dependencies. After that, execute npm start to run the app.

How do I start a React project from scratch? ›

The React team primarily recommends these solutions:
  1. If you're learning React or creating a new single-page app, use Create React App.
  2. If you're building a server-rendered website with Node.js, try Next.js.
  3. If you're building a static content-oriented website, try Gatsby.

How do I add a project to React? ›

Here's how we recommend to set it up:
  1. Build the React part of your app using one of the React-based frameworks.
  2. Specify /some-app as the base path in your framework's configuration (here's how: Next.js, Gatsby).
  3. Configure your server or a proxy so that all requests under /some-app/ are handled by your React app.

How do I run a local React project? ›

Dive Into React Development: How To Run React App Locally
  1. Prerequisites: Install Node and a Package Manager. ...
  2. Setting Up Your Local Development Environment. ...
  3. Creating a New React App with NPX. ...
  4. Exploring the React App Structure and Important Files. ...
  5. Running the React App Locally with npm start.
Feb 21, 2024

How do I start a React project in Windows? ›

How To Install React on Windows
  1. Step 1: Install Node. js and npm.
  2. Step 2: Install Create React App.
  3. Step 3: Create a New React Project.
  4. Step 4: Go To the Project Directory and Start the Development Server.
Jun 6, 2023

What is the easiest way to start React? ›

When starting a React project, a simple HTML page with script tags might still be the best option. It only takes a minute to set up! As your application grows, you might want to consider a more integrated setup. There are several JavaScript toolchains we recommend for larger applications.

How do I start a React project in browser? ›

First of all , To run react js app in web browser, there is no need of internet. Open command prompt, Then go to folder where reactJs app is created in command prompt, Then go to in reactJs app in command prompt, Then run react app using this "npm start". How to study react?

How do I deploy a React project? ›

Deploying React applications is a quick process when you use Create React App. You run the build command to create a directory of all the files you need for a deployment. After running the build, you copy the files to the correct location on the server, pushing your application live to the web.

How do I publish a React project to npm? ›

  1. Create React App. Create the following file structure for your React npm package: ...
  2. create a `package.json` file with the following content: { ...
  3. Create your component. ...
  4. Add a `.gitignore` file. ...
  5. Install babel dependencies and create . ...
  6. Build your package. ...
  7. Publish your package.

How do I start working on React project? ›

Create a New React App

When starting a React project, a simple HTML page with script tags might still be the best option. It only takes a minute to set up! As your application grows, you might want to consider a more integrated setup. There are several JavaScript toolchains we recommend for larger applications.

How do I start a React project in CMD? ›

Open a terminal(Windows Command Prompt or PowerShell). Create a new project folder: mkdir ReactProjects and enter that directory: cd ReactProjects . This command will start up the Node. js server and launch a new browser window displaying your app.

How to build React project for production? ›

How to create a Production build production for your React app?
  1. Step 1: Firstly, let us start: create a new React application.
  2. Step 2: Then navigate to the project folder.
  3. Step 3: Now, let us customize our app by editing the default code. ...
  4. Step 4: Run the application (development mode).
Feb 25, 2022

What is a build in React? ›

React production build creates minified bundles, lighter-weight source maps, and optimized assets. This improves the load time. React recommends using production mode while deploying the React app. We now know that production build helps in optimizing performance.

Top Articles
Which is the best seat to grab in a cinema hall? | Hindi Movie News - Times of India
Home
Dainty Rascal Io
I Make $36,000 a Year, How Much House Can I Afford | SoFi
Bashas Elearning
Fat Hog Prices Today
Chicago Neighborhoods: Lincoln Square & Ravenswood - Chicago Moms
Goodbye Horses: The Many Lives of Q Lazzarus
Eric Rohan Justin Obituary
Flights to Miami (MIA)
Mlifeinsider Okta
Southland Goldendoodles
Morgan Wallen Pnc Park Seating Chart
Https //Advanceautoparts.4Myrebate.com
Hca Florida Middleburg Emergency Reviews
Dexter Gomovies
Who called you from 6466062860 (+16466062860) ?
Theresa Alone Gofundme
Ruse For Crashing Family Reunions Crossword
Skip The Games Fairbanks Alaska
We Discovered the Best Snow Cone Makers for Carnival-Worthy Desserts
Pokemon Unbound Shiny Stone Location
The Weather Channel Local Weather Forecast
Parc Soleil Drowning
The Largest Banks - ​​How to Transfer Money With Only Card Number and CVV (2024)
Southland Goldendoodles
Reser Funeral Home Obituaries
Cb2 South Coast Plaza
Walgreens On Bingle And Long Point
2015 Kia Soul Serpentine Belt Diagram
Miles City Montana Craigslist
Bayard Martensen
1636 Pokemon Fire Red U Squirrels Download
Mami No 1 Ott
Where to eat: the 50 best restaurants in Freiburg im Breisgau
Mbi Auto Discount Code
Where Can I Cash A Huntington National Bank Check
Goodwill Thrift Store & Donation Center Marietta Photos
Petsmart Northridge Photos
2008 DODGE RAM diesel for sale - Gladstone, OR - craigslist
Barber Gym Quantico Hours
Armageddon Time Showtimes Near Cmx Daytona 12
What Is A K 56 Pink Pill?
Live Delta Flight Status - FlightAware
Ukraine-Krieg - Militärexperte: "Momentum bei den Russen"
21 Alive Weather Team
Noh Buddy
Suntory Yamazaki 18 Jahre | Whisky.de » Zum Online-Shop
Estes4Me Payroll
Southwind Village, Southend Village, Southwood Village, Supervision Of Alcohol Sales In Church And Village Halls
Anthony Weary Obituary Erie Pa
Latest Posts
Article information

Author: Twana Towne Ret

Last Updated:

Views: 6158

Rating: 4.3 / 5 (64 voted)

Reviews: 87% of readers found this page helpful

Author information

Name: Twana Towne Ret

Birthday: 1994-03-19

Address: Apt. 990 97439 Corwin Motorway, Port Eliseoburgh, NM 99144-2618

Phone: +5958753152963

Job: National Specialist

Hobby: Kayaking, Photography, Skydiving, Embroidery, Leather crafting, Orienteering, Cooking

Introduction: My name is Twana Towne Ret, I am a famous, talented, joyous, perfect, powerful, inquisitive, lovely person who loves writing and wants to share my knowledge and understanding with you.