You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/reference/react/useImperativeHandle.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,15 +38,15 @@ function MyInput({ ref }) {
38
38
39
39
#### Parametreler {/*parameters*/}
40
40
41
-
* `ref`: The `ref` you received as a prop to the `MyInput` component.
41
+
* `ref`: `MyInput` bileşenine prop olarak aldığınız `ref`.
42
42
43
43
* `createHandle`: Herhangi bir argüman almayan ve açığa çıkarmak istediğiniz ref tanımlayıcısını döndüren bir fonksiyondur. Bu ref tanımlayıcısı herhangi bir tipte olabilir. Genellikle, açığa çıkarmak istediğiniz metotların bulunduğu bir nesne döndürürsünüz.
44
44
45
45
* **isteğe bağlı** `dependencies`: `createHandle` kodu içinde referans alınan tüm tepkisel değerlerin listesidir. Tepkisel değerler, prop'lar, state ve bileşeninizin doğrudan içerisinde bildirilen tüm değişkenler ve fonskiyonlar gibi değerleri içerir. Eğer linter'ınız [React için yapılandırılmışsa](/learn/editor-setup#linting), her tepkisel değerin doğru bir şekilde bağımlılık(dependency) olarak belirtildiğini doğrular. Bağımlılık listesi, sabit bir sayıda öğeye sahip olmalı ve `[dep1, dep2, dep3]` gibi iç içe yazılmalıdır. React, her bir bağımlılığı önceki değeriyle [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is) karşılaştırması kullanarak karşılaştırır. Eğer bir yeniden render'lama, bazı bağımlılıklarda değişikliğe neden olduysa veya bu argümanı atladıysanız, `createHandle` fonksiyonunuz yeniden çalıştırılır ve yeni oluşturulan tanımlayıcı ref'e atanır.
46
46
47
47
<Note>
48
48
49
-
Starting with React 19, [`ref`is available a prop.](/blog/2024/12/05/react-19#ref-as-a-prop) In React 18 and earlier, it was necessary to get the `ref` from [`forwardRef`.](/reference/react/forwardRef)
49
+
React 19 ile birlikte, [`ref`bir prop olarak mevcuttur.](/blog/2024/12/05/react-19#ref-as-a-prop) React 18 ve öncesinde, `ref`'i [`forwardRef`'den](/reference/react/forwardRef) almak gerekiyordu.
50
50
51
51
</Note>
52
52
@@ -60,15 +60,15 @@ Starting with React 19, [`ref` is available a prop.](/blog/2024/12/05/react-19#r
60
60
61
61
### Özel bir ref tanımlayıcısını üst elemana açığa çıkarma {/*exposing-a-custom-ref-handle-to-the-parent-component*/}
62
62
63
-
To expose a DOM node to the parent element, pass in the `ref` prop to the node.
63
+
Bir DOM düğümünü ebeveyn elemana açığa çıkarmak için, `ref` prop'unu düğüme iletin.
64
64
65
65
```js {2}
66
66
functionMyInput({ ref }) {
67
67
return<input ref={ref} />;
68
68
};
69
69
```
70
70
71
-
With the code above, [a ref to `MyInput` will receive the`<input>` DOM node.](/learn/manipulating-the-dom-with-refs) However, you can expose a custom value instead. To customize the exposed handle, call `useImperativeHandle`at the top level of your component:
71
+
Yukarıdaki kodla, [`MyInput`'e ait bir ref,`<input>` DOM düğümünü alacaktır.](/learn/manipulating-the-dom-with-refs) Ancak bunun yerine özel bir değer de açığa çıkarabilirsiniz. Açığa çıkan handle'ı özelleştirmek için, bileşeninizin üst seviyesinde `useImperativeHandle`çağırın:
72
72
73
73
```js {4-8}
74
74
import { useImperativeHandle } from'react';
@@ -84,7 +84,7 @@ function MyInput({ ref }) {
84
84
};
85
85
```
86
86
87
-
Note that in the code above, the `ref` is no longer passed to the `<input>`.
87
+
Yukarıdaki kodda, `ref`'in artık `<input>`'a iletilmediğine dikkat edin.
88
88
89
89
Örneğin, `<input>` DOM düğümünün tamamını açığa çıkarmak istemiyorsunuz, ancak `focus` ve `scrollIntoView` gibi iki metodu açığa çıkarmak istiyorsunuz. Bunun için gerçek tarayıcı DOM'unu ayrı bir ref içinde tutun. Ardından, yalnızca üst elemanın çağırmasını istediğiniz metotlara sahip bir tanımlayıcıyı açığa çıkarmak için `useImperativeHandle`'ı kullanın:
0 commit comments