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
3.Aynı uygulama içerisinde **birden fazla React kopyası**mevcuttur.
16
16
17
-
Let's look at each of these cases.
17
+
Tüm bu durumları tek tek inceleyelim.
18
18
19
-
## Mismatching Versions of React and React DOM {#mismatching-versions-of-react-and-react-dom}
19
+
## React ve React DOM sürümlerinin uyumsuz olması {#mismatching-versions-of-react-and-react-dom}
20
20
21
-
You might be using a version of `react-dom` (< 16.8.0) or`react-native` (< 0.59) that doesn't yet support Hooks. You can run `npm ls react-dom`or`npm ls react-native`in your application folder to check which version you're using. If you find more than one of them, this might also create problems (more on that below).
21
+
Henüz Hook desteklemeyen `react-dom` (< 16.8.0) veya`react-native` (< 0.59) bir sürüm kullanıyor olabilirsiniz. Kullanılan sürümü öğrenmek için `npm ls react-dom`veya`npm ls react-native`komutlarını çalıştırabilirsiniz. Eğer birden fazla sürüm bulundu ise sorun bundan olabilir (devamı aşağıda).
22
22
23
-
## Breaking the Rules of Hooks {#breaking-the-rules-of-hooks}
To avoid confusion, it’s **not** supported to call Hooks in other cases:
46
+
Karışıklığı önlemek için, diğer durumlarda Hook'ları kullanmak **desteklenmez**:
47
47
48
-
* 🔴 Do not call Hooks in class components.
49
-
* 🔴 Do not call in event handlers.
50
-
* 🔴 Do not call Hooks inside functions passed to `useMemo`, `useReducer`, or`useEffect`.
48
+
* 🔴 Sınıf bileşenin içinde çağırmayın.
49
+
* 🔴 Olay yöneticisi içinde çağırmayın.
50
+
* 🔴 `useMemo`, `useReducer`, veya`useEffect` içinde Hook'ları kullanmayın
51
51
52
-
If you break these rules, you might see this error.
52
+
Bu kuralları çiğnerseniz aşağadıki hataları görebilirsiniz.
53
53
54
54
```js{3-4,11-12,20-21}
55
55
function Bad1() {
56
56
function handleClick() {
57
-
// 🔴 Bad: inside an event handler (to fix, move it outside!)
57
+
// 🔴 Kötü: Olay yöneticisi içinde (düzeltmek için dışarı taşı!)
58
58
const theme = useContext(ThemeContext);
59
59
}
60
60
// ...
61
61
}
62
62
63
63
function Bad2() {
64
64
const style = useMemo(() => {
65
-
// 🔴 Bad: inside useMemo (to fix, move it outside!)
65
+
// 🔴 Kötü: useMemo içinde (düzeltmek için dışarı taşı!)
66
66
const theme = useContext(ThemeContext);
67
67
return createStyle(theme);
68
68
});
@@ -71,52 +71,53 @@ function Bad2() {
71
71
72
72
class Bad3 extends React.Component {
73
73
render() {
74
-
// 🔴 Bad: inside a class component
74
+
// 🔴 Kötü: Sınıf bileşenin içinde
75
75
useEffect(() => {})
76
76
// ...
77
77
}
78
78
}
79
79
```
80
80
81
-
You can use the [`eslint-plugin-react-hooks` plugin](https://www.npmjs.com/package/eslint-plugin-react-hooks)to catch some of these mistakes.
81
+
[`eslint-plugin-react-hooks`](https://www.npmjs.com/package/eslint-plugin-react-hooks)eklentisini kullanarak bu hataları yakalayabilirsiniz.
82
82
83
-
>Note
83
+
>Not
84
84
>
85
-
>[Custom Hooks](/docs/hooks-custom.html)*may* call other Hooks (that's their whole purpose). This works because custom Hooks are also supposed to only be called while a function component is rendering.
85
+
>[Özel Hook'lar](/docs/hooks-custom.html)başka Hook'ları çağıralabilir(tüm amaçları budur). Bu işe yarar, çünkü Hook'lar yalnızca bir fonksiyon bileşeni içerisindeszn çağırılabiliyordu.
86
86
87
87
88
-
## Duplicate React {#duplicate-react}
88
+
## Birden Fazla React {#duplicate-react}
89
89
90
-
In order for Hooks to work, the`react`import from your application code needs to resolve to the same module as the `react` import from inside the `react-dom` package.
90
+
Hook'ların çalışması için, uygulama kodunuza import ettiğiniz`react`ile `react-dom` içerisindeki `react` aynı olmalıdır.
91
91
92
-
If these `react` imports resolve to two different exports objects, you will see this warning. This may happen if you **accidentally end up with two copies** of the `react` package.
92
+
Eğer bunlar farklı ise bu uyarıyı alabilirsiniz . **Yanlışlıkla 2 farklı react sürümüne ait paket kurulmuş olabilir**.
93
93
94
-
If you use Node for package management, you can run this check in your project folder:
94
+
Paket yönetimi için node kullanıyorsanız bu komutu proje içerisinde çalıştırabilirsiniz:
95
95
96
96
npm ls react
97
97
98
-
If you see more than one React, you'll need to figure out why this happens and fix your dependency tree. For example, maybe a library you're using incorrectly specifies `react` as a dependency (rather than a peer dependency). Until that library is fixed, [Yarn resolutions](https://yarnpkg.com/lang/en/docs/selective-version-resolutions/)is one possible workaround.
98
+
Eğer birden fazla react sürümü görürseniz bu sorunu çözmeniz gerekmektedir. Örneğin yanlış kullandığınız bir kütüphane `React`'ı bağımlılık olarak belirtir(aynı react'ı kullanmak yerine).Bu kütüphane düzeltilinceye kadar, [Yarn resolutions](https://yarnpkg.com/lang/en/docs/selective-version-resolutions/)olası geçici çözümdür.
99
99
100
-
You can also try to debug this problem by adding some logs and restarting your development server:
100
+
Ayrıca, bazı log'lar ekleyerek ve sunucuyu yeniden başlatarak bu sorunu çözmeyi deneyebilirsiniz:
If it prints `false`then you might have two Reacts and need to figure out why that happened. [This issue](https://github.com/facebook/react/issues/13991) includes some common reasons encountered by the community.
112
+
Eğer ekrana `false`yazıyorsa iki farklı react olabilir ve bunun neden olduğunu çözmeniz gerekebilir. [Bu sorun](https://github.com/facebook/react/issues/13991), topluluğun karşılaştığı bazı genel nedenleri içerir.
113
113
114
-
This problem can also come up when you use `npm link` or an equivalent. In that case, your bundler might "see" two Reacts — one in application folder and one in your library folder. Assuming `myapp` and `mylib` are sibling folders, one possible fix is to run `npm link ../myapp/node_modules/react` from `mylib`. This should make the library use the application's React copy.
114
+
Bu sorun, `npm link` veya eşdeğer bir komut kullandığınızda ortaya çıkabilir. Bu durumda paket yöneticiniz, biri uygulama içerisinde bir diğeri kütüphane klasörü içerisinde olmak üzere 2 farklı React görebilir.
115
+
`myapp` ve `mylib` kardeş klasöler olduğu varsayılırsa olası bir düzeltme için `mylib` klasöründe `npm link` komutu çalıştırılmalıdır.Bu, kütüphanenin uygulama içerisindeki React kopyasını kullanmasını sağlar
115
116
116
-
>Note
117
+
>Not
117
118
>
118
-
>In general, React supports using multiple independent copies on one page (for example, if an app and a third-party widget both use it). It only breaks if `require('react')`resolves differently between the component and the `react-dom`copy it was rendered with.
119
+
>Genel olarak, React bir sayfada birden fazla bağımsız kopya kullanmayı destekler(örneğin bir uygulama ve üçüncü-party bir eklenti kullanıyorsa). `require('react')`sadece, bileşen içerisindeki ile `react-dom`içerisindeki sürümler farklı ise çalışmaz.
119
120
120
-
## Other Causes {#other-causes}
121
+
## Diğer Nedenler {#other-causes}
121
122
122
-
If none of this worked, please comment in [this issue](https://github.com/facebook/react/issues/13991)and we'll try to help. Try to create a small reproducing example — you might discover the problem as you're doing it.
123
+
Bunların hiçbiri işe yaramaz ise lütfen bize [bu sorun başlığı](https://github.com/facebook/react/issues/13991)altında yorum bırakın.Size yardımcı olmaya çalışacağız.Küçük bir uygulama oluşturarak tekrar deneyebilirsiniz — belki hatayı bu şekilde bulabilirsiniz.
0 commit comments