Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync with react.dev @ ab18d2f0 #1158

Merged
merged 64 commits into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
ee361b5
Update React Paris conference year to 2025 (#7439)
mikedidomizio Jan 21, 2025
e88e3d0
React Native Connection is back in 2025 (#7311)
viteinfinite Jan 21, 2025
b03017a
fix typo (#7440)
slavgetov Jan 21, 2025
c140d2c
Update conferences.md for CityJS Athens and London Events (#7425)
arismarko Jan 22, 2025
7cdbed0
Mention startTransition in useActionState docs (#7448)
sophiebits Jan 24, 2025
07f13ab
[ci] Add workflow to label PRs from core team (#7451)
poteto Jan 24, 2025
2f24839
[ci] Specify is_remote input to maintainer check workflow (#7453)
poteto Jan 24, 2025
a5aad0d
[ci] Update discord notification bot to use remote workflow (#7455)
poteto Jan 24, 2025
4d44167
import missing useState in the useEffect markdown file (#7457)
SruthiKrish19 Jan 27, 2025
066b6c1
bumped up the versions of docsearch packages (#7458)
phanendraguptha Jan 27, 2025
9001bc6
docs: Correct var reference in prerender example (#7434)
rschristian Jan 27, 2025
305db5f
Capitalized Suspense in a few files (#7449)
renatodellosso Jan 27, 2025
ef705c7
Update Eli's github username on the team page (#7460)
elicwhite Jan 27, 2025
3bb7a4e
Team page updates (#7438)
rickhanlonii Jan 27, 2025
0eb0f88
feat: migrate React.dev to the App Router (#7437)
feedthejim Feb 1, 2025
af0358f
Revert "feat: migrate React.dev to the App Router (#7437)" (#7466)
gaearon Feb 1, 2025
6fc98ff
Fix Vite URLs (#7462)
karlhorky Feb 2, 2025
91614a5
Clarify security updates in versioning-policy.md (#7485)
sophiebits Feb 9, 2025
9a18bcd
docs: add javascript colombo, sri lanka meetup (#7289)
brionmario Feb 10, 2025
7cb25e3
Adding React Helsinki meetup (#7474)
hencca Feb 10, 2025
c76a1f7
Added React Nexus 2025 to the conference list (#7463)
akiran Feb 10, 2025
dfc4448
Reference docs for `captureOwnerStack` (#7427)
eps1lon Feb 13, 2025
7cf1f50
Blog and docs: Sunsetting Create React App (#7495)
rickhanlonii Feb 14, 2025
3ba4f8c
Fix misspelling in cra blog post (#7496)
poteto Feb 14, 2025
294c731
fix(docs): wrong redirect link to /learn/creating-a-react-app on Crea…
otabekshoyimov Feb 16, 2025
c438e9a
fix(docs): wrong vite command (#7615)
elitalpa Feb 16, 2025
4928421
Add Rsbuild as a build tool for React projects (#7608)
chenjiahan Feb 16, 2025
1923248
fix(docs): webpack branding states it should be lower case (#7617)
zackarychapple Feb 17, 2025
09f39a0
fix: Dashboard component name in blogpost (#7621)
erasmoh Feb 17, 2025
604407a
Updates from feedback (#7624)
rickhanlonii Feb 17, 2025
34e13df
Fix setup page (#7607)
jasonqiu212 Feb 18, 2025
1a4183a
fix: typo for issue #7491 (#7493)
TheCaptain1810 Feb 18, 2025
c7099e3
Fix headings and add link (#7626)
rickhanlonii Feb 18, 2025
c726e7d
Fix broken heading link (#7627)
rickhanlonii Feb 18, 2025
aaf392a
Fix more broken links (#7628)
rickhanlonii Feb 18, 2025
32cb13a
updated incorrect logic (#7482)
timmparsons Feb 18, 2025
2cf6668
Update react-19-upgrade-guide.md (#7411)
amirsaeed671 Feb 18, 2025
ff12973
Fix error in second code snippet under Server Functions with Actions …
hyundonmoon Feb 18, 2025
0593d01
Fix typo in render-and-commit.md (#7405)
rammba Feb 18, 2025
126d8c9
Update nextjs link with the latest URL (#7389)
alex-safian Feb 18, 2025
55d1f8f
Update input.md (#7418)
pierluc-codes Feb 18, 2025
f3e9921
clarify alert message behavior in issue #7494 (#7629)
Punith1117 Feb 18, 2025
c03f029
Fix broken header link in CRA blog post(#7632)
yaodingyd Feb 18, 2025
383b389
Remove forwardRefs from recap and challenges (#7475)
dixita0607 Feb 19, 2025
6ef277a
Update CRA to Parcel migration guide (#7638)
devongovett Feb 20, 2025
a42121e
fix: correct typo in hydrateRoot.md (#7637)
hjunyoung Feb 20, 2025
dcaf07e
chore(docs): add mention that React will drop all extraneous props fo…
samcx Feb 22, 2025
fc29603
Fix 'optimistically updating form data' demo bug (#7646)
subliun Feb 22, 2025
4a4e579
docs(hydrateRoot): update suppressHydrationWarning behavior (#7651)
samcx Feb 26, 2025
cc774fa
removing Provider as in React 19 Context can be used as a provider (#…
karthik-awebon Feb 27, 2025
5f09d9f
Invalid bluesky dev account link (#7653)
JosefHartsough Feb 27, 2025
6326e7b
[ci] Run notify workflow on open or ready for review (#7660)
poteto Feb 28, 2025
ab18d2f
docs: update creating-a-react-app.md (broken link anchor) (#7671)
lauthieb Mar 6, 2025
1a5f7a9
merging all conflicts
react-translations-bot Mar 17, 2025
53dc2ad
Merge branch 'main' into sync-ab18d2f0
lumirlumir Mar 17, 2025
88c6b58
chore: update `yarn.lock`
lumirlumir Mar 17, 2025
91e1220
ci: delete unnecessary workflows
lumirlumir Mar 17, 2025
689e52a
docs: resolve conflicts
lumirlumir Mar 17, 2025
e4ded40
docs: resolve conflicts
lumirlumir Mar 17, 2025
3b18f39
docs: resolve conflicts
lumirlumir Mar 17, 2025
892ad00
chore: update `.editorconfig`
lumirlumir Mar 17, 2025
3043f85
chore: update `tsconfig.json`
lumirlumir Mar 17, 2025
b6bb3ae
docs: update `react-labs-what-we-have-been-...-2022.md`
lumirlumir Mar 17, 2025
e00dc3f
docs: resolve conflicts in `useActionState.md`
lumirlumir Mar 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
trim_trailing_whitespace = true
1 change: 1 addition & 0 deletions src/components/MDX/CodeBlock/CodeBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ function getInlineDecorators(
line.step === 3,
'bg-green-40 border-green-40 text-green-60 dark:text-green-30':
line.step === 4,
// TODO: Some codeblocks use up to 6 steps.
}
),
})
Expand Down
4 changes: 2 additions & 2 deletions src/content/blog/2024/04/25/react-19-upgrade-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To help make the upgrade to React 19 easier, we've published a `[email protected]` rele

We recommend upgrading to React 18.3 first to help identify any issues before upgrading to React 19.

For a list of changes in 18.3 see the [Release Notes](https://github.com/facebook/react/blob/main/CHANGELOG.md).
For a list of changes in 18.3 see the [Release Notes](https://github.com/facebook/react/blob/main/CHANGELOG.md#1830-april-25-2024).

</Note>

Expand Down Expand Up @@ -113,7 +113,7 @@ This will run the following codemods from `react-codemod`:
- [`replace-string-ref`](https://github.com/reactjs/react-codemod?tab=readme-ov-file#replace-string-ref)
- [`replace-act-import`](https://github.com/reactjs/react-codemod?tab=readme-ov-file#replace-act-import)
- [`replace-use-form-state`](https://github.com/reactjs/react-codemod?tab=readme-ov-file#replace-use-form-state)
- [`prop-types-typescript`](https://codemod.com/registry/react-prop-types-typescript)
- [`prop-types-typescript`](https://github.com/reactjs/react-codemod#react-proptypes-to-prop-types)

This does not include the TypeScript changes. See [TypeScript changes](#typescript-changes) below.

Expand Down
2 changes: 1 addition & 1 deletion src/content/blog/2024/12/05/react-19.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ A component was suspended by an uncached promise. Creating promises inside a Cli

</ConsoleBlockMulti>

To fix, you need to pass a promise from a suspense powered library or framework that supports caching for promises. In the future we plan to ship features to make it easier to cache promises in render.
To fix, you need to pass a promise from a Suspense powered library or framework that supports caching for promises. In the future we plan to ship features to make it easier to cache promises in render.

</Note>

Expand Down
320 changes: 320 additions & 0 deletions src/content/blog/2025/02/14/sunsetting-create-react-app.md

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/content/blog/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ title: React 블로그

<div className="sm:-mx-5 flex flex-col gap-5 mt-12">

<BlogCard title="Sunsetting Create React App" date="February 13, 2025" url="/blog/2025/02/14/sunsetting-create-react-app">

Today, we’re deprecating Create React App for new apps, and encouraging existing apps to migrate to a framework, or to migrate to a build tool like Vite, Parcel, or RSBuild. We’re also providing docs for when a framework isn’t a good fit for your project, you want to build your own framework, or you just want to learn how React works by building a React app from scratch ...

</BlogCard>

<BlogCard title="React v19 " date="December 5, 2024" url="/blog/2024/12/05/react-19">

In the React 19 Upgrade Guide, we shared step-by-step instructions for upgrading your app to React 19. In this post, we'll give an overview of the new features in React 19, and how you can adopt them ...
Expand Down
1 change: 1 addition & 0 deletions src/content/community/conferences.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ April 3 (Reanimated Training) + April 4 (Conference), 2025. Paris, France.
[Website](https://reactnativeconnection.io/) - [X](https://x.com/reactnativeconn) - [Bluesky](https://bsky.app/profile/reactnativeconnect.bsky.social)

### CityJS London 2025 {/*cityjs-london*/}

April 23 - 25, 2025. In-person in London, UK

[Website](https://london.cityjsconf.org/) - [Twitter](https://x.com/cityjsconf) - [Bluesky](https://bsky.app/profile/cityjsconf.bsky.social)
Expand Down
6 changes: 4 additions & 2 deletions src/content/community/versioning-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ React의 모든 안정적인 빌드는 높은 수준의 테스트를 거치고

</Intro>

지난 버전을 확인하려면, [React 버전](/versions) 페이지를 참고해주세요.
This versioning policy describes our approach to version numbers for packages such as `react` and `react-dom`. 지난 버전을 확인하려면, [React 버전](/versions) 페이지를 참고해주세요.

## Stable releases {/*stable-releases*/}

Expand All @@ -23,7 +23,9 @@ Stable React releases (also known as “Latest” release channel) follow [seman

마이너 릴리즈는 릴리즈의 가장 흔한 유형입니다.

### Breaking Changes {/*breaking-changes*/}
We know our users continue to use old versions of React in production. If we learn of a security vulnerability in React, we release a backported fix for all major versions that are affected by the vulnerability.

### Breaking changes {/*breaking-changes*/}

Breaking Changes는 모두에게 불편하기에 우리는 메이저 릴리즈의 수를 최소화하려고 노력합니다. 예를 들어, React 15는 2016년 4월에 릴리즈, React 16은 2017년 9월에 릴리즈, React 17은 2020년 10월에 릴리즈되었습니다.

Expand Down
4 changes: 4 additions & 0 deletions src/content/learn/add-react-to-an-existing-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ title: 기존 프로젝트에 React 추가하기

* **이미 애플리케이션이 `import` 문을 이용해 파일로 분리하고 있다면** 기존에 가지고 있는 설정을 이용해 보세요. JS 코드에서 `<div />`를 작성하면 문법 오류가 발생하는지 확인해 보세요. 문법 오류가 발생한다면 [Babel을 이용한 자바스크립트 코드 변환](https://babeljs.io/setup)이 필요할 수 있으며, JSX를 사용하려면 [Babel React 프리셋](https://babeljs.io/docs/babel-preset-react)을 활성화해야 할 수도 있습니다.

* **If your app doesn't have an existing setup for compiling JavaScript modules,** set it up with [Vite](https://vite.dev/). The Vite community maintains [many integrations with backend frameworks](https://github.com/vitejs/awesome-vite#integrations-with-backends), including Rails, Django, and Laravel. If your backend framework is not listed, [follow this guide](https://vite.dev/guide/backend-integration.html) to manually integrate Vite builds with your backend.

* **애플리케이션이 자바스크립트 모듈을 컴파일하기 위한 기존 설정이 없다면,** [Vite](https://vitejs.dev/)를 이용하여 설정하세요. Vite 커뮤니티는 Rails, Django, Laravel을 포함한 [다양한 백엔드 프레임워크와의 통합](https://github.com/vitejs/awesome-vite#integrations-with-backends)을 지원하고 있습니다. 사용 중인 백엔드 프레임워크가 목록에 없다면 [가이드를 참고하여](https://vitejs.dev/guide/backend-integration.html) Vite 빌드를 백엔드와 수동으로 통합하세요.

설정이 제대로 동작하는지 확인하려면 프로젝트 폴더에서 아래 명령어를 실행하세요.
Expand Down Expand Up @@ -88,6 +90,8 @@ root.render(<h1>Hello, world</h1>);

처음으로 기존 프로젝트에 모듈 자바스크립트 환경을 통합하기는 다소 어려워 보일 수 있으나, 그만한 가치가 있는 일입니다! 어려움을 겪는 부분이 있다면 [커뮤니티 리소스](/community)나 [Vite 채팅](https://chat.vitejs.dev/)을 이용해 보세요.

Integrating a modular JavaScript environment into an existing project for the first time can feel intimidating, but it's worth it! If you get stuck, try our [community resources](/community) or the [Vite Chat](https://chat.vite.dev/).

</Note>


Expand Down
143 changes: 143 additions & 0 deletions src/content/learn/build-a-react-app-from-scratch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
---
title: Build a React app from Scratch
---

<Intro>

If your app has constraints not well-served by existing frameworks, you prefer to build your own framework, or you just want to learn the basics of a React app, you can build a React app from scratch.

</Intro>

<DeepDive>

#### Consider using a framework {/*consider-using-a-framework*/}

Starting from scratch is an easy way to get started using React, but a major tradeoff to be aware of is that going this route is often the same as building your own adhoc framework. As your requirements evolve, you may need to solve more framework-like problems that our recommended frameworks already have well developed and supported solutions for.

For example, if in the future your app needs support for server-side rendering (SSR), static site generation (SSG), and/or React Server Components (RSC), you will have to implement those on your own. Similarly, future React features that require integrating at the framework level will have to be implemented on your own if you want to use them.

Our recommended frameworks also help you build better performing apps. For example, reducing or eliminating waterfalls from network requests makes for a better user experience. This might not be a high priority when you are building a toy project, but if your app gains users you may want to improve its performance.

Going this route also makes it more difficult to get support, since the way you develop routing, data-fetching, and other features will be unique to your situation. You should only choose this option if you are comfortable tackling these problems on your own, or if you’re confident that you will never need these features.

For a list of recommended frameworks, check out [Creating a React App](/learn/creating-a-react-app).

</DeepDive>


## Step 1: Install a build tool {/*step-1-install-a-build-tool*/}

The first step is to install a build tool like `vite`, `parcel`, or `rsbuild`. These build tools provide features to package and run source code, provide a development server for local development and a build command to deploy your app to a production server.

### Vite {/*vite*/}

[Vite](https://vite.dev/) is a build tool that aims to provide a faster and leaner development experience for modern web projects.

<TerminalBlock>
{`npm create vite@latest my-app -- --template react`}
</TerminalBlock>

Vite is opinionated and comes with sensible defaults out of the box. Vite has a rich ecosystem of plugins to support fast refresh, JSX, Babel/SWC, and other common features. See Vite's [React plugin](https://vite.dev/plugins/#vitejs-plugin-react) or [React SWC plugin](https://vite.dev/plugins/#vitejs-plugin-react-swc) and [React SSR example project](https://vite.dev/guide/ssr.html#example-projects) to get started.

Vite is already being used as a build tool in one of our [recommended frameworks](/learn/creating-a-react-app): [React Router](https://reactrouter.com/start/framework/installation).

### Parcel {/*parcel*/}

[Parcel](https://parceljs.org/) combines a great out-of-the-box development experience with a scalable architecture that can take your project from just getting started to massive production applications.

<TerminalBlock>
{`npm install --save-dev parcel`}
</TerminalBlock>

Parcel supports fast refresh, JSX, TypeScript, Flow, and styling out of the box. See [Parcel's React recipe](https://parceljs.org/recipes/react/#getting-started) to get started.

### Rsbuild {/*rsbuild*/}

[Rsbuild](https://rsbuild.dev/) is an Rspack-powered build tool that provides a seamless development experience for React applications. It comes with carefully tuned defaults and performance optimizations ready to use.

<TerminalBlock>
{`npx create-rsbuild --template react`}
</TerminalBlock>

Rsbuild includes built-in support for React features like fast refresh, JSX, TypeScript, and styling. See [Rsbuild's React guide](https://rsbuild.dev/guide/framework/react) to get started.

<Note>

#### Metro for React Native {/*react-native*/}

If you'd you're starting from scratch with React Native you'll need to use [Metro](https://metrobundler.dev/), the JavaScript bundler for React Native. Metro supports bundling for platforms like iOS and Android, but lacks many features when compared to the tools here. We recommend starting with Vite, Parcel, or Rsbuild unless your project requires React Native support.

</Note>

## Step 2: Build Common Application Patterns {/*step-2-build-common-application-patterns*/}

The build tools listed above start off with a client-only, single-page app (SPA), but don't include any further solutions for common functionality like routing, data fetching, or styling.

The React ecosystem includes many tools for these problems. We've listed a few that are widely used as a starting point, but feel free to choose other tools if those work better for you.

### Routing {/*routing*/}

Routing determines what content or pages to display when a user visits a particular URL. You need to set up a router to map URLs to different parts of your app. You'll also need to handle nested routes, route parameters, and query parameters. Routers can be configured within your code, or defined based on your component folder and file structures.

Routers are a core part of modern applications, and are usually integrated with data fetching (including prefetching data for a whole page for faster loading), code splitting (to minimize client bundle sizes), and page rendering approaches (to decide how each page gets generated).

We suggest using:

- [React Router](https://reactrouter.com/start/framework/custom)
- [Tanstack Router](https://tanstack.com/router/latest)


### Data Fetching {/*data-fetching*/}

Fetching data from a server or other data source is a key part of most applications. Doing this properly requires handling loading states, error states, and caching the fetched data, which can be complex.

Purpose-built data fetching libraries do the hard work of fetching and caching the data for you, letting you focus on what data your app needs and how to display it. These libraries are typically used directly in your components, but can also be integrated into routing loaders for faster pre-fetching and better performance, and in server rendering as well.

Note that fetching data directly in components can lead to slower loading times due to network request waterfalls, so we recommend prefetching data in router loaders or on the server as much as possible! This allows a page's data to be fetched all at once as the page is being displayed.

If you're fetching data from most backends or REST-style APIs, we suggest using:

- [React Query](https://react-query.tanstack.com/)
- [SWR](https://swr.vercel.app/)
- [RTK Query](https://redux-toolkit.js.org/rtk-query/overview)

If you're fetching data from a GraphQL API, we suggest using:

- [Apollo](https://www.apollographql.com/docs/react)
- [Relay](https://relay.dev/)


### Code-splitting {/*code-splitting*/}

Code-splitting is the process of breaking your app into smaller bundles that can be loaded on demand. An app's code size increases with every new feature and additional dependency. Apps can become slow to load because all of the code for the entire app needs to be sent before it can be used. Caching, reducing features/dependencies, and moving some code to run on the server can help mitigate slow loading but are incomplete solutions that can sacrifice functionality if overused.

Similarly, if you rely on the apps using your framework to split the code, you might encounter situations where loading becomes slower than if no code splitting were happening at all. For example, [lazily loading](/reference/react/lazy) a chart delays sending the code needed to render the chart, splitting the chart code from the rest of the app. [Parcel supports code splitting with React.lazy](https://parceljs.org/recipes/react/#code-splitting). However, if the chart loads its data *after* it has been initially rendered you are now waiting twice. This is a waterfall: rather than fetching the data for the chart and sending the code to render it simultaneously, you must wait for each step to complete one after the other.

Splitting code by route, when integrated with bundling and data fetching, can reduce the initial load time of your app and the time it takes for the largest visible content of the app to render ([Largest Contentful Paint](https://web.dev/articles/lcp)).

For code-splitting instructions, see your build tool docs:
- [Vite build optimizations](https://v3.vitejs.dev/guide/features.html#build-optimizations)
- [Parcel code splitting](https://parceljs.org/features/code-splitting/)
- [Rsbuild code splitting](https://rsbuild.dev/guide/optimization/code-splitting)

### Improving Application Performance {/*improving-application-performance*/}

Since the build tool you select only support single page apps (SPAs) you'll need to implement other [rendering patterns](https://www.patterns.dev/vanilla/rendering-patterns) like server-side rendering (SSR), static site generation (SSG), and/or React Server Components (RSC). Even if you don't need these features at first, in the future there may be some routes that would benefit SSR, SSG or RSC.

* **Single-page apps (SPA)** load a single HTML page and dynamically updates the page as the user interacts with the app. SPAs are easier to get started with, but they can have slower initial load times. SPAs are the default architecture for most build tools.

* **Streaming Server-side rendering (SSR)** renders a page on the server and sends the fully rendered page to the client. SSR can improve performance, but it can be more complex to set up and maintain than a single-page app. With the addition of streaming, SSR can be very complex to set up and maintain. See [Vite's SSR guide]( https://vite.dev/guide/ssr).

* **Static site generation (SSG)** generates static HTML files for your app at build time. SSG can improve performance, but it can be more complex to set up and maintain than server-side rendering. See [Vite's SSG guide](https://vite.dev/guide/ssr.html#pre-rendering-ssg).

* **React Server Components (RSC)** lets you mix build-time, server-only, and interactive components in a single React tree. RSC can improve performance, but it currently requires deep expertise to set up and maintain. See [Parcel's RSC examples](https://github.com/parcel-bundler/rsc-examples).

Your rendering strategies need to integrate with your router so apps built with your framework can choose the rendering strategy on a per-route level. This will enable different rendering strategies without having to rewrite your whole app. For example, the landing page for your app might benefit from being statically generated (SSG), while a page with a content feed might perform best with server-side rendering.

Using the right rendering strategy for the right routes can decrease the time it takes for the first byte of content to be loaded ([Time to First Byte](https://web.dev/articles/ttfb)), the first piece of content to render ([First Contentful Paint](https://web.dev/articles/fcp)), and the largest visible content of the app to render ([Largest Contentful Paint](https://web.dev/articles/lcp)).

### And more... {/*and-more*/}

These are just a few examples of the features a new app will need to consider when building from scratch. Many limitations you'll hit can be difficult to solve as each problem is interconnected with the others and can require deep expertise in problem areas you may not be familiar with.

If you don't want to solve these problems on your own, you can [get started with a framework](/learn/creating-a-react-app) that provides these features out of the box.
Loading