diff --git a/src/content/reference/react-dom/client/createRoot.md b/src/content/reference/react-dom/client/createRoot.md index 59832de78..fd760092e 100644 --- a/src/content/reference/react-dom/client/createRoot.md +++ b/src/content/reference/react-dom/client/createRoot.md @@ -45,9 +45,9 @@ Tamamen React ile oluşturulmuş bir uygulama genellikle kök bileşeni için ya * **opsiyonel** `options`: Bu React kökü için seçenekler içeren bir nesne. - * **optional** `onCaughtError`: Callback called when React catches an error in an Error Boundary. Called with the `error` caught by the Error Boundary, and an `errorInfo` object containing the `componentStack`. - * **optional** `onUncaughtError`: Callback called when an error is thrown and not caught by an Error Boundary. Called with the `error` that was thrown, and an `errorInfo` object containing the `componentStack`. - * **optional** `onRecoverableError`: React'in hatalardan otomatik olarak kurtulduğunda çağrılan callback fonksiyonu. Called with an `error` React throws, and an `errorInfo` object containing the `componentStack`. Some recoverable errors may include the original error cause as `error.cause`. + * **opsiyonel** `onCaughtError`: React bir Hata yakalayıcı bir hata yakaladığında callback yapılır. Hata yakalayıcı tarafından yakalanan `error` ve `componentStack` içeren bir `errorInfo` nesnesi ile çağrılır. + * **opsiyonel** Bir hata fırlatıldığında ve bir Hata yakalayıcı tarafından yakalanmadığında callback yapılır. Atılan hata ve `componentStack`'i içeren bir `errorInfo` nesnesi ile çağrılır. + * **opsiyonel** `onRecoverableError`: React'in hatalardan otomatik olarak kurtulduğunda çağrılan callback fonksiyonu. React'in attığı bir `error` ve `componentStack` içeren bir `errorInfo` nesnesi ile çağrılır. Bazı kurtarılabilir hatalar, `error.cause` olarak orijinal hata nedenini içerebilir. * **opsiyonel** `identifierPrefix`: [`useId`](/reference/react/useId) tarafından oluşturulan kimlikler için React'in kullandığı bir dize öneki. Aynı sayfada birden fazla kök kullanırken çakışmaları önlemek için kullanışlıdır. @@ -345,15 +345,15 @@ export default function App({counter}) { Birden fazla kez `render` çağrısı yapmak nadirdir. Genellikle bileşenleriniz bunun yerine [state güncellemesi](/reference/react/useState) yapacaktır. -### Show a dialog for uncaught errors {/*show-a-dialog-for-uncaught-errors*/} +### Yakalanmamış hatalar için bir diyaloğu gösterme {/*show-a-dialog-for-uncaught-errors*/} -`onUncaughtError` is only available in the latest React Canary release. +`onUncaughtError` sadece en son React Canary sürümünde mevcuttur. -By default, React will log all uncaught errors to the console. To implement your own error reporting, you can provide the optional `onUncaughtError` root option: +Varsayılan olarak, React tüm yakalanmamış hataları konsola kaydeder. Kendi hata raporlamanızı uygulamak için, isteğe bağlı `onUncaughtError` root seçeneğini sağlayabilirsin: ```js [[1, 6, "onUncaughtError"], [2, 6, "error", 1], [3, 6, "errorInfo"], [4, 10, "componentStack"]] import { createRoot } from 'react-dom/client'; @@ -363,7 +363,7 @@ const root = createRoot( { onUncaughtError: (error, errorInfo) => { console.error( - 'Uncaught error', + 'Yakalanmamış hata', error, errorInfo.componentStack ); @@ -373,12 +373,13 @@ const root = createRoot( root.render(); ``` -The onUncaughtError option is a function called with two arguments: +onUncaughtError seçeneği iki bağımsız değişkenle çağrılan bir fonksiyondur: -1. The error that was thrown. -2. An errorInfo object that contains the componentStack of the error. +1. Fırlatılan hata. -You can use the `onUncaughtError` root option to display error dialogs: +2. Hatanın componentStack'ini içeren bir errorInfo nesnesi. + +Hata diyalog pencerelerini görüntülemek için `onUncaughtError` kök seçeneğini kullanabilirsin: @@ -386,7 +387,7 @@ You can use the `onUncaughtError` root option to display error dialogs: - My app + Benim uygulamam
@@ -526,15 +527,15 @@ function reportError({ title, error, componentStack, dismissable }) { } export function reportCaughtError({error, cause, componentStack}) { - reportError({ title: "Caught Error", error, componentStack, dismissable: true}); + reportError({ title: "Yakalanan Hata", error, componentStack, dismissable: true}); } export function reportUncaughtError({error, cause, componentStack}) { - reportError({ title: "Uncaught Error", error, componentStack, dismissable: false }); + reportError({ title: "Yakalanmamış Hata", error, componentStack, dismissable: false }); } export function reportRecoverableError({error, cause, componentStack}) { - reportError({ title: "Recoverable Error", error, componentStack, dismissable: true }); + reportError({ title: "Kurtarılabilir Hata", error, componentStack, dismissable: true }); } ``` @@ -570,9 +571,9 @@ export default function App() { return (
- This error shows the error dialog: + Bu hata, hata diyaloğunu gösterir:
); @@ -593,15 +594,15 @@ export default function App() {
-### Displaying Error Boundary errors {/*displaying-error-boundary-errors*/} +### Hata yakalayıcı ile ilgili hataları görüntüleme {/*displaying-error-boundary-errors*/} -`onCaughtError` is only available in the latest React Canary release. +`onCaughtError` sadece en son React Canary sürümünde mevcuttur. -By default, React will log all errors caught by an Error Boundary to `console.error`. To override this behavior, you can provide the optional `onCaughtError` root option to handle errors caught by an [Error Boundary](/reference/react/Component#catching-rendering-errors-with-an-error-boundary): +Varsayılan olarak, React bir Hata yakalayıcı tarafından yakalanan tüm hataları `console.error` dosyasına kaydeder. Bu davranışı geçersiz kılmak için, bir Hata yakalayıcı tarafından yakalanan hataları işlemek üzere isteğe bağlı `onCaughtError` kök seçeneğini sağlayabilirsin. [Hata yakalayıcı](/reference/react/Component#catching-rendering-errors-with-an-error-boundary): ```js [[1, 6, "onCaughtError"], [2, 6, "error", 1], [3, 6, "errorInfo"], [4, 10, "componentStack"]] import { createRoot } from 'react-dom/client'; @@ -611,7 +612,7 @@ const root = createRoot( { onCaughtError: (error, errorInfo) => { console.error( - 'Caught error', + 'Yakalanan hata', error, errorInfo.componentStack ); @@ -621,12 +622,12 @@ const root = createRoot( root.render(); ``` -The onCaughtError option is a function called with two arguments: +onCaughtError seçeneği iki bağımsız değişkenle çağrılan bir fonksiyondur: -1. The error that was caught by the boundary. -2. An errorInfo object that contains the componentStack of the error. +1. Hata yakalayıcı tarafından yakalanan hata. +2. Hatanın componentStack'ini içeren bir errorInfo nesnesi. -You can use the `onCaughtError` root option to display error dialogs or filter known errors from logging: +Hata diyologlarını görüntülemek veya bilinen hataları günlükten filtrelemek için `onCaughtError` kök seçeneğini kullanabilirsin: @@ -634,7 +635,7 @@ You can use the `onCaughtError` root option to display error dialogs or filter k - My app + Benim uygulamam
@@ -774,15 +775,15 @@ function reportError({ title, error, componentStack, dismissable }) { } export function reportCaughtError({error, cause, componentStack}) { - reportError({ title: "Caught Error", error, componentStack, dismissable: true}); + reportError({ title: "Yakalanan Hata", error, componentStack, dismissable: true}); } export function reportUncaughtError({error, cause, componentStack}) { - reportError({ title: "Uncaught Error", error, componentStack, dismissable: false }); + reportError({ title: "Yakalanmamış Hata", error, componentStack, dismissable: false }); } export function reportRecoverableError({error, cause, componentStack}) { - reportError({ title: "Recoverable Error", error, componentStack, dismissable: true }); + reportError({ title: "Kurtarılabilir Hata", error, componentStack, dismissable: true }); } ``` @@ -830,13 +831,13 @@ export default function App() { }} > {error != null && } - This error will not show the error dialog: + Bu hata, hata diyaloğunu göstermeyecektir: - This error will show the error dialog: + Bu hata, hata diyoloğunu gösterecektir: @@ -847,9 +848,9 @@ export default function App() { function fallbackRender({ resetErrorBoundary }) { return (
-

Error Boundary

-

Something went wrong.

- +

Hata Yakalayıcı

+

Bir şeyler ters gitti.

+
); } @@ -877,9 +878,9 @@ function Throw({error}) {
-### Displaying a dialog for recoverable errors {/*displaying-a-dialog-for-recoverable-errors*/} +### Kurtarılabilir hatalar için bir diyoloğu görüntüleme {/*displaying-a-dialog-for-recoverable-errors*/} -React may automatically render a component a second time to attempt to recover from an error thrown in render. If successful, React will log a recoverable error to the console to notify the developer. To override this behavior, you can provide the optional `onRecoverableError` root option: +React, render etme sırasında atılan bir hatadan kurtulmayı denemek için bir bileşeni otomatik olarak ikinci kez render edebilir. Başarılı olursa, React geliştiriciyi bilgilendirmek için konsola kurtarılabilir bir hata günlüğü kaydeder. Bu davranışı geçersiz kılmak için, isteğe bağlı `onRecoverableError` kök seçeneğini sağlayabilirsin: ```js [[1, 6, "onRecoverableError"], [2, 6, "error", 1], [3, 10, "error.cause"], [4, 6, "errorInfo"], [5, 11, "componentStack"]] import { createRoot } from 'react-dom/client'; @@ -889,7 +890,7 @@ const root = createRoot( { onRecoverableError: (error, errorInfo) => { console.error( - 'Recoverable error', + 'Kurtarılabilir hata', error, error.cause, errorInfo.componentStack, @@ -900,12 +901,13 @@ const root = createRoot( root.render(); ``` -The onRecoverableError option is a function called with two arguments: +onRecoverableError seçeneği iki bağımsız değişkenle çağrılan bir fonksiyondur: + +1. React'in fırlattığı hata. Bazı hatalar, error.cause olarak orijinal nedeni içerebilir. -1. The error that React throws. Some errors may include the original cause as error.cause. -2. An errorInfo object that contains the componentStack of the error. +2. Hatanın componentStack'ini içeren bir errorInfo nesnesi. -You can use the `onRecoverableError` root option to display error dialogs: +Hata diyaloglarını görüntülemek için `onRecoverableError` kök seçeneğini kullanabilirsin: @@ -913,7 +915,7 @@ You can use the `onRecoverableError` root option to display error dialogs: - My app + Benim uygulamam
@@ -1053,15 +1055,15 @@ function reportError({ title, error, componentStack, dismissable }) { } export function reportCaughtError({error, cause, componentStack}) { - reportError({ title: "Caught Error", error, componentStack, dismissable: true}); + reportError({ title: "Yakalanan Hata", error, componentStack, dismissable: true}); } export function reportUncaughtError({error, cause, componentStack}) { - reportError({ title: "Uncaught Error", error, componentStack, dismissable: false }); + reportError({ title: "Yakalanmamış Hata", error, componentStack, dismissable: false }); } export function reportRecoverableError({error, cause, componentStack}) { - reportError({ title: "Recoverable Error", error, componentStack, dismissable: true }); + reportError({ title: "Kurtarılabilir Hata", error, componentStack, dismissable: true }); } ``` @@ -1097,8 +1099,8 @@ export default function App() { fallbackRender={fallbackRender} > {!errorThrown && } -

This component threw an error, but recovered during a second render.

-

Since it recovered, no Error Boundary was shown, but onRecoverableError was used to show an error dialog.

+

Bu bileşen bir hata fırlattı, ancak ikinci bir render etme sırasında düzeldi.

+

Kurtarıldığı için Hata yakalayıcı gösterilmedi, ancak bir hata diyoloğu göstermek için onRecoverableError kullanıldı.

@@ -1108,8 +1110,8 @@ export default function App() { function fallbackRender() { return (
-

Error Boundary

-

Something went wrong.

+

Hata Yakalayıcı

+

Bir şeyler ters gitti.

); } @@ -1155,17 +1157,17 @@ Bunu yapana kadar hiçbir şey görüntülenmez. --- -### I'm getting an error: "You passed a second argument to root.render" {/*im-getting-an-error-you-passed-a-second-argument-to-root-render*/} +### Bir hata alıyorum: "root.render'a ikinci bir argüman geçtiniz" {/*im-getting-an-error-you-passed-a-second-argument-to-root-render*/} -A common mistake is to pass the options for `createRoot` to `root.render(...)`: +Sık yapılan bir hata, `createRoot` seçeneklerini `root.render(...)` öğesine aktarmaktır: -Warning: You passed a second argument to root.render(...) but it only accepts one argument. +Uyarı: root.render(...) öğesine ikinci bir bağımsız değişken ilettiniz, ancak bu öğe yalnızca bir bağımsız değişken kabul eder. -To fix, pass the root options to `createRoot(...)`, not `root.render(...)`: +Düzeltmek için, kök seçeneklerini `root.render(...)` yerine `createRoot(...)` öğesine aktarın: ```js {2,5} // 🚩 Wrong: root.render only takes one argument. root.render(App, {onUncaughtError});