Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
73d7073
fix: correct overlay highlighting in code examples (#7669)
mrbadri May 15, 2025
4a7bdc1
fix: the value property of checkbox to the checked property (#7804)
kosh-jp May 16, 2025
ae4a40a
No need for useState here — useCounter handles the state internally (…
gbhardwaj00 May 16, 2025
a73055f
docs: fix misplaced prepositional phrase error (#7799)
mehmetmalli May 16, 2025
e2d9fd7
Fix wrong documentation for effect events (#7800)
gbhardwaj00 May 16, 2025
b92bb59
Remove stray console.log and image (#7814)
rickhanlonii May 16, 2025
b3b2166
fix(template): remove unnecessary import of React in template code (#…
dahoho May 16, 2025
9fb0519
fix(reference): correct singular form of 'Server Functions' to 'Serve…
dahoho May 16, 2025
69ce5d3
Add bold mono font (#7815)
rickhanlonii May 16, 2025
8b2fe2b
Remove TODO comments and convert them to issues (#7743)
BartoszKlonowski May 16, 2025
00587d6
Add example of `useActionState` handling execution order (#7733)
ajits01 May 16, 2025
79e1c48
docs: update vite link (#7784)
bornkiss May 16, 2025
c289cd0
docs: add bsky link (#7781)
bornkiss May 16, 2025
7ab1969
React Montreal Meetings have a new link (#7809)
EricCote May 16, 2025
f275c9d
fix: remove useless content (#6615)
loveloki May 17, 2025
0b68054
fix: wrong verb tense in doc (#7818)
aalhoura May 17, 2025
65d297e
fix: typo in challenge solution (#7816)
aalhoura May 17, 2025
828714d
merging all conflicts
react-translations-bot May 19, 2025
1dcae39
sync-65d297e9 dev sync and fix conflicts
bilalkarakollu May 24, 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
Binary file added public/fonts/Source-Code-Pro-Bold.woff2
Binary file not shown.
Binary file modified public/fonts/Source-Code-Pro-Regular.woff2
Binary file not shown.
Binary file removed public/images/blog/react-labs-april-2025/flip.gif
Binary file not shown.
3 changes: 2 additions & 1 deletion src/components/Layout/HomeContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,8 @@ function ExampleLayout({
</div>
<div
ref={contentRef}
className="relative mt-0 lg:-my-20 w-full p-2.5 xs:p-5 lg:p-10 flex grow justify-center">
className="relative mt-0 lg:-my-20 w-full p-2.5 xs:p-5 lg:p-10 flex grow justify-center"
dir="ltr">
{right}
<div
className={cn(
Expand Down
2 changes: 1 addition & 1 deletion src/components/MDX/Sandpack/template.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const template = {
'/src/index.js': {
hidden: true,
code: `import React, { StrictMode } from "react";
code: `import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "./styles.css";

Expand Down
1 change: 0 additions & 1 deletion src/components/PageHeading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function PageHeading({
tags = [],
breadcrumbs,
}: PageHeadingProps) {
console.log('version', version);
return (
<div className="px-5 sm:px-12 pt-3.5">
<div className="max-w-4xl ms-0 2xl:mx-auto">
Expand Down
9 changes: 8 additions & 1 deletion src/components/Seo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,14 @@ export const Seo = withRouter(
)}
<link
rel="preload"
href="/fonts/Source-Code-Pro-Regular.woff2"
href="https://react.dev/fonts/Source-Code-Pro-Regular.woff2"
as="font"
type="font/woff2"
crossOrigin="anonymous"
/>
<link
rel="preload"
href="https://react.dev/fonts/Source-Code-Pro-Bold.woff2"
as="font"
type="font/woff2"
crossOrigin="anonymous"
Expand Down
2 changes: 1 addition & 1 deletion src/content/community/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ Her topluluk, binlerce React kullanıcısından oluşur.

## Haberler {/*news*/}

React ile ilgili en güncel haberler için, [Twitter'da **@reactjs** hesabını](https://twitter.com/reactjs) ve Bu website'de bulunan [React Resmi Blogunu](/blog/) takip edin.
React ile ilgili en güncel haberler için, [Twitter da **@reactjs** hesabını](https://twitter.com/reactjs), [Bluesky da **@react.dev** hesabını](https://bsky.app/profile/react.dev) ve bu sitedeki [Resmi React blog'unu](/blog/) takip edebilirsiniz.
2 changes: 1 addition & 1 deletion src/content/community/meetups.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Do you have a local React.js meetup? Add it here! (Please keep the list alphabet

## Canada {/*canada*/}
* [Halifax, NS](https://www.meetup.com/Halifax-ReactJS-Meetup/)
* [Montreal, QC - React Native](https://www.meetup.com/fr-FR/React-Native-MTL/)
* [Montreal, QC](https://guild.host/react-montreal/)
* [Vancouver, BC](https://www.meetup.com/ReactJS-Vancouver-Meetup/)
* [Ottawa, ON](https://www.meetup.com/Ottawa-ReactJS-Meetup/)
* [Saskatoon, SK](https://www.meetup.com/saskatoon-react-meetup/)
Expand Down
2 changes: 1 addition & 1 deletion src/content/learn/build-a-react-app-from-scratch.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Similarly, if you rely on the apps using your framework to split the code, you m
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)
- [Vite build optimizations](https://vite.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)

Expand Down
4 changes: 2 additions & 2 deletions src/content/learn/preserving-and-resetting-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -2028,7 +2028,7 @@ export default function ContactList() {
<label>
<input
type="checkbox"
value={reverse}
checked={reverse}
onChange={e => {
setReverse(e.target.checked)
}}
Expand Down Expand Up @@ -2127,7 +2127,7 @@ export default function ContactList() {
<label>
<input
type="checkbox"
value={reverse}
checked={reverse}
onChange={e => {
setReverse(e.target.checked)
}}
Expand Down
2 changes: 1 addition & 1 deletion src/content/learn/removing-effect-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ export default function Timer() {

</Sandpack>

Efekt içinde `count` okumak yerine, React'e bir `c => c + 1` komutu ("bu sayıyı artır!") iletirsiniz. React bunu bir sonraki render'da uygulayacaktır. Ve artık Efektinizin içinde `count` değerini okumanıza gerek olmadığından, Efektinizin bağımlılıklarını boş tutabilirsiniz (`[]`). Bu, Efektinizin her tikte aralığı yeniden oluşturmasını önler.
`count` değerini Efekt içinde okumak yerine, React'e `c => c + 1` talimatını ("bu sayıyı artır!") verirsiniz. React bu işlemi bir sonraki render'da uygular. Artık Efekt'in içinde `count` değerini okumanıza gerek kalmadığı için, Efekt'in bağımlılık dizisini boş (`[]`) bırakabilirsiniz. Bu da, her tikte Efekt'in yeniden oluşturulmasını engeller.

</Solution>

Expand Down
3 changes: 1 addition & 2 deletions src/content/learn/reusing-logic-with-custom-hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ export default function ChatRoom({ roomId }) {
// ...
```

başka bir Hook'a girdi olarak nasıl illetiğinizi farkedin:
ve onu başka bir Hook'a girdi olarak vermek:

```js {6}
export default function ChatRoom({ roomId }) {
Expand Down Expand Up @@ -2087,7 +2087,6 @@ export function useCounter(delay) {
<Sandpack>

```js
import { useState } from 'react';
import { useCounter } from './useCounter.js';

export default function Counter() {
Expand Down
15 changes: 5 additions & 10 deletions src/content/learn/separating-events-from-effects.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ function ChatRoom({ roomId, theme }) {
// ...
```

Bu sorunu çözer. Efektinizin bağımlılıkları listesinden `onConnected` öğesini *kaldırmanız* gerektiğini unutmayın. **Efekt olayları reaktif değildir ve bağımlılıklardan çıkarılmalıdır.**
Bu, problemi çözer. Dikkat etmen gereken nokta, Efekt içinde artık kullanılmadığı için `theme` öğesini bağımlılıklar listesinden *çıkarman* gerektiğidir. Ayrıca `onConnected` öğesini listeye *eklemene* de gerek yoktur çünkü **Efekt Olayları reaktif değildir ve bağımlılıklardan çıkarılmalıdır.**

Yeni davranışın beklediğiniz gibi çalıştığını doğrulayın:

Expand Down Expand Up @@ -789,7 +789,6 @@ body {

</Sandpack>


Bu kodla ilgili sorun, bağımlılık linterinin bastırılmasıdır. Bastırmayı kaldırırsanız, bu Efektin `handleMove` fonksiyonuna bağlı olması gerektiğini görürsünüz. Bu mantıklıdır: `handleMove` bileşen gövdesi içinde bildirilir, bu da onu reaktif bir değer yapar. Her reaktif değer bir bağımlılık olarak belirtilmelidir, aksi takdirde zaman içinde eskimesi olasıdır!

Orijinal kodun yazarı, Effect'in herhangi bir reaktif değere bağlı olmadığını (`[]`) söyleyerek React'e "yalan söylemiştir". Bu nedenle React, `canMove` değiştikten sonra (ve onunla birlikte `handleMove`) Efekti yeniden senkronize etmedi. React, Efekti yeniden senkronize etmediği için, dinleyici olarak eklenen `handleMove`, ilk render sırasında oluşturulan `handleMove` fonksiyonudur. İlk render sırasında `canMove` `true` idi, bu yüzden ilk renderdan `handleMove` sonsuza kadar bu değeri görecektir.
Expand Down Expand Up @@ -886,8 +885,8 @@ Bu bölümde, React'in kararlı bir sürümünde henüz yayınlanmamış **deney

Efekt Olayları, kullanma şekliniz açısından oldukça sınırlıdır:

* **Sadece Efektlerin içinden çağırın.**
* **Asla diğer bileşenlere veya Hook'lara aktarmayın.**
- **Sadece Efektlerin içinden çağırın.**
- **Asla diğer bileşenlere veya Hook'lara aktarmayın.**

Örneğin, bir Efekt olayını şu şekilde bildirmeyin ve geçirmeyin:

Expand Down Expand Up @@ -1216,7 +1215,6 @@ export default function Timer() {
}
```


```css
button { margin: 10px; }
```
Expand All @@ -1233,7 +1231,7 @@ Bu örnekte, aralık gecikmesini özelleştirebilirsiniz. Bu, iki düğme taraf

<Hint>

Effect olayları içindeki kod reaktif değildir. `setInterval` çağrısının yeniden çalışmasını _istediğiniz_ durumlar var mı?
Effect olayları içindeki kod reaktif değildir. `setInterval` çağrısının yeniden çalışmasını *istediğiniz* durumlar var mı?

</Hint>

Expand Down Expand Up @@ -1313,7 +1311,6 @@ export default function Timer() {
}
```


```css
button { margin: 10px; }
```
Expand Down Expand Up @@ -1402,7 +1399,7 @@ button { margin: 10px; }

</Sandpack>

Genel olarak, bir kod parçasının *amacından* ziyade *zamanlamasına* odaklanan `onMount` gibi fonksiyonlara şüpheyle yaklaşmalısınız. İlk başta "daha açıklayıcı" gelebilir ancak amacınızı gizler. Genel bir kural olarak, Efekt olayları *kullanıcının* bakış açısından gerçekleşen bir şeye karşılık gelmelidir. Örneğin, `onMessage`, `onTick`, `onVisit` veya `onConnected` iyi Effect olay adlarıdır. İçlerindeki kodun muhtemelen reaktif olması gerekmeyecektir. Öte yandan, `onMount`, `onUpdate`, `onUnmount` veya `onAfterRender` o kadar geneldir ki, yanlışlıkla * reaktif olması gereken * kodları bunlara koymak kolaydır. Bu nedenle, Efekt olaylarınızı bazı kodların ne zaman çalıştığına göre değil, *kullanıcının ne olduğunu düşündüğüne göre* adlandırmalısınız.
Genel olarak, bir kod parçasının *amacından* ziyade *zamanlamasına* odaklanan `onMount` gibi fonksiyonlara şüpheyle yaklaşmalısınız. İlk başta "daha açıklayıcı" gelebilir ancak amacınızı gizler. Genel bir kural olarak, Efekt olayları *kullanıcının* bakış açısından gerçekleşen bir şeye karşılık gelmelidir. Örneğin, `onMessage`, `onTick`, `onVisit` veya `onConnected` iyi Effect olay adlarıdır. İçlerindeki kodun muhtemelen reaktif olması gerekmeyecektir. Öte yandan, `onMount`, `onUpdate`, `onUnmount` veya `onAfterRender` o kadar geneldir ki, yanlışlıkla *reaktif olması gereken* kodları bunlara koymak kolaydır. Bu nedenle, Efekt olaylarınızı bazı kodların ne zaman çalıştığına göre değil, *kullanıcının ne olduğunu düşündüğüne göre* adlandırmalısınız.

</Solution>

Expand Down Expand Up @@ -1837,10 +1834,8 @@ label { display: block; margin-top: 10px; }

</Sandpack>


Bu, oda değiştirdiğinizde önceden planlanmış (ancak henüz görüntülenmemiş) bildirimlerin iptal edilmesini sağlar.


</Solution>

</Challenges>
2 changes: 1 addition & 1 deletion src/content/reference/react-dom/preinit.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ The `preinit` function provides the browser with a hint that it should start dow
* `options`: an object. It contains the following properties:
* `as`: a required string. The type of resource. Its possible values are `script` and `style`.
* `precedence`: a string. Required with stylesheets. Says where to insert the stylesheet relative to others. Stylesheets with higher precedence can override those with lower precedence. The possible values are `reset`, `low`, `medium`, `high`.
* `crossOrigin`: a string. The [CORS policy](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) to use. Its possible values are `anonymous` and `use-credentials`. It is required when `as` is set to `"fetch"`.
* `crossOrigin`: a string. The [CORS policy](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) to use. Its possible values are `anonymous` and `use-credentials`.
* `integrity`: a string. A cryptographic hash of the resource, to [verify its authenticity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity).
* `nonce`: a string. A cryptographic [nonce to allow the resource](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/nonce) when using a strict Content Security Policy.
* `fetchPriority`: a string. Suggests a relative priority for fetching the resource. The possible values are `auto` (the default), `high`, and `low`.
Expand Down
161 changes: 160 additions & 1 deletion src/content/reference/react/useTransition.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function CheckoutForm() {

The function passed to `startTransition` is called the "Action". You can update state and (optionally) perform side effects within an Action, and the work will be done in the background without blocking user interactions on the page. A Transition can include multiple Actions, and while a Transition is in progress, your UI stays responsive. For example, if the user clicks a tab but then changes their mind and clicks another tab, the second click will be immediately handled without waiting for the first update to finish.

To give the user feedback about in-progress Transitions, to `isPending` state switches to `true` at the first call to `startTransition`, and stays `true` until all Actions complete and the final state is shown to the user. Transitions ensure side effects in Actions to complete in order to [prevent unwanted loading indicators](#preventing-unwanted-loading-indicators), and you can provide immediate feedback while the Transition is in progress with `useOptimistic`.
To give the user feedback about in-progress Transitions, the `isPending` state switches to `true` at the first call to `startTransition`, and stays `true` until all Actions complete and the final state is shown to the user. Transitions ensure side effects in Actions to complete in order to [prevent unwanted loading indicators](#preventing-unwanted-loading-indicators), and you can provide immediate feedback while the Transition is in progress with `useOptimistic`.

<Recipes titleText="The difference between Actions and regular event handling">

Expand Down Expand Up @@ -1949,3 +1949,162 @@ When clicking multiple times, it's possible for previous requests to finish afte
This is expected, because Actions within a Transition do not guarantee execution order. For common use cases, React provides higher-level abstractions like [`useActionState`](/reference/react/useActionState) and [`<form>` actions](/reference/react-dom/components/form) that handle ordering for you. For advanced use cases, you'll need to implement your own queuing and abort logic to handle this.


Example of `useActionState` handling execution order:

<Sandpack>

```json package.json hidden
{
"dependencies": {
"react": "beta",
"react-dom": "beta"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
```

```js src/App.js
import { useState, useActionState } from "react";
import { updateQuantity } from "./api";
import Item from "./Item";
import Total from "./Total";

export default function App({}) {
// Store the actual quantity in separate state to show the mismatch.
const [clientQuantity, setClientQuantity] = useState(1);
const [quantity, updateQuantityAction, isPending] = useActionState(
async (prevState, payload) => {
setClientQuantity(payload);
const savedQuantity = await updateQuantity(payload);
return savedQuantity; // Return the new quantity to update the state
},
1 // Initial quantity
);

return (
<div>
<h1>Checkout</h1>
<Item action={updateQuantityAction}/>
<hr />
<Total clientQuantity={clientQuantity} savedQuantity={quantity} isPending={isPending} />
</div>
);
}

```

```js src/Item.js
import {startTransition} from 'react';

export default function Item({action}) {
function handleChange(e) {
// Update the quantity in an Action.
startTransition(() => {
action(e.target.value);
});
}
return (
<div className="item">
<span>Eras Tour Tickets</span>
<label htmlFor="name">Quantity: </label>
<input
type="number"
onChange={handleChange}
defaultValue={1}
min={1}
/>
</div>
)
}
```

```js src/Total.js
const intl = new Intl.NumberFormat("en-US", {
style: "currency",
currency: "USD"
});

export default function Total({ clientQuantity, savedQuantity, isPending }) {
return (
<div className="total">
<span>Total:</span>
<div>
<div>
{isPending
? "🌀 Updating..."
: `${intl.format(savedQuantity * 9999)}`}
</div>
<div className="error">
{!isPending &&
clientQuantity !== savedQuantity &&
`Wrong total, expected: ${intl.format(clientQuantity * 9999)}`}
</div>
</div>
</div>
);
}
```

```js src/api.js
let firstRequest = true;
export async function updateQuantity(newName) {
return new Promise((resolve, reject) => {
if (firstRequest === true) {
firstRequest = false;
setTimeout(() => {
firstRequest = true;
resolve(newName);
// Simulate every other request being slower
}, 1000);
} else {
setTimeout(() => {
resolve(newName);
}, 50);
}
});
}
```

```css
.item {
display: flex;
align-items: center;
justify-content: start;
}

.item label {
flex: 1;
text-align: right;
}

.item input {
margin-left: 4px;
width: 60px;
padding: 4px;
}

.total {
height: 50px;
line-height: 25px;
display: flex;
align-content: center;
justify-content: space-between;
}

.total div {
display: flex;
flex-direction: column;
align-items: flex-end;
}

.error {
color: red;
}
```

</Sandpack>
2 changes: 1 addition & 1 deletion src/content/reference/rsc/server-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ To support Server Functions as a bundler or framework, we recommend pinning to a

</Note>

When a Server Functions is defined with the [`"use server"`](/reference/rsc/use-server) directive, your framework will automatically create a reference to the server function, and pass that reference to the Client Component. When that function is called on the client, React will send a request to the server to execute the function, and return the result.
When a Server Function is defined with the [`"use server"`](/reference/rsc/use-server) directive, your framework will automatically create a reference to the server function, and pass that reference to the Client Component. When that function is called on the client, React will send a request to the server to execute the function, and return the result.

Server Functions can be created in Server Components and passed as props to Client Components, or they can be imported and used in Client Components.

Expand Down
2 changes: 0 additions & 2 deletions src/content/warnings/react-dom-test-utils.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: react-dom/test-utils Deprecation Warnings
---

TODO: update for 19?

## ReactDOMTestUtils.act() warning {/*reactdomtestutilsact-warning*/}

`act` from `react-dom/test-utils` has been deprecated in favor of `act` from `react`.
Expand Down
2 changes: 0 additions & 2 deletions src/content/warnings/react-test-renderer.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
title: react-test-renderer Deprecation Warnings
---

TODO: Update this for 19?

## ReactTestRenderer.create() warning {/*reacttestrenderercreate-warning*/}

react-test-renderer is deprecated. A warning will fire whenever calling ReactTestRenderer.create() or ReactShallowRender.render(). The react-test-renderer package will remain available on NPM but will not be maintained and may break with new React features or changes to React's internals.
Expand Down
Loading