Skip to content

Commit 4cbc0cc

Browse files
authored
392. satırda kaldım
1 parent 9162208 commit 4cbc0cc

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

1-js/13-modules/02-import-export/article.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -277,28 +277,27 @@ new User('John');
277277
278278
### Varsayılan içeriye aktarmayı kullanmalı mıyım?
279279
280-
One should be careful about using default exports, because they are more difficult to maintain.
280+
Varsayılan dışa aktarım kullanımlarında dikkat edilmelidir. Çünkü bakımı daha zordur.
281281
282-
Named exports are explicit. They exactly name what they import, so we have that information from them, that's a good thing.
282+
Adlandırılmış açıktır. Aldıkları şeyi tam olarak açıklıyorlar. Bu yüzden onlardan bu bilgilere sahibiz. Bu iyi bir şey.
283283
284-
Also, named exports enforce us to use exactly the right name to import:
284+
Ayrıca, adlandırılmış dışa aktarma işlemleri bizi içe aktarmak için doğru adı kullanmaya zorlar.:
285285
286286
```js
287287
import {User} from './user.js';
288-
// import {MyUser} won't work, the name must be {User}
288+
// import {MyUser} çalışmayacak, adı {User} olmalı
289289
```
290290
291-
For default exports, we always choose the name when importing:
291+
Varsayılan içeriye aktarma için içeriye aktarırken her zaman adı seçeriz:
292292
293293
```js
294-
import User from './user.js'; // works
295-
import MyUser from './user.js'; // works too
296-
// could be import Anything..., and it'll be work
294+
import User from './user.js'; // çalışır
295+
import MyUser from './user.js'; // çalışır
296+
// Bir şey içeriye aktarılabilir..., ve çalışacaktır
297297
```
298+
Yani, kötüye kullanılabilecek biraz daha fazla özgürlük var. Böylece ekip üyeleri aynı şey için farklı isimler kullanabilirler.
298299
299-
So, there's a little bit more freedom that can be abused, so that team members may use different names for the same thing.
300-
301-
Usually, to avoid that and keep the code consistent, there's a rule that imported variables should correspond to file names, e.g:
300+
Genelde, bundan kaçınmak ve kodu tutarlı tutmak için içe aktarılan değişkenlerin dosya adlarına karşılık gelmesi gerektiği bir kural vardır:
302301
303302
```js
304303
import User from './user.js';
@@ -307,24 +306,24 @@ import func from '/path/to/func.js';
307306
...
308307
```
309308
310-
Another solution would be to use named exports everywhere. Even if only a single thing is exported, it's still exported under a name, without `default`.
309+
Başka bir çözüm, her yerde adlandırılmış içeriye aktarım kullanmak olacaktır. Sadece tek bir şey içeriye aktarılsa bile yine de `default` olmadan bir isim altında içeriye aktarılır.
311310
312-
That also makes re-export (see below) a little bit easier.
311+
Bu da re-export (aşağıda göreceksin) biraz daha kolay hale gelir.
313312
314313
## Re-export
315314
316-
"Re-export" syntax `export ... from ...` allows to import things and immediately export them (possibly under another name), like this:
315+
"Re-export" söz dizimi `export ... from ...` şeyleri içeriye aktarmasına ve hemen (başka bir isim altında) içeriye aktarmasına izin verir:
317316
318317
```js
319318
export {sayHi} from './say.js';
320319
export {default as User} from './user.js';
321320
```
322321
323-
What's the point, why that's needed? Let's see a practical use case.
322+
Amaç ne? Neden bu gerekli? Pratik bir kullanım örneği görelim.
324323
325-
Imagine, we're writing a "package": a folder with a lot of modules, mostly needed internally, with some of the functionality exported outside (tools like NPM allow to publish and distribute packages, but here it doesn't matter).
324+
Bir "paket" yazdığımızı düşünelim: dışarıda dışa aktarılan fonksiyonelliklerin bir kısmı ile çoğunlukla dahili olarak ihtiyaç duyulan birçok modüle sahip bir klasör (NPM gibi araçlar paketleri yayınlamaya ve dağıtmaya izin verir, ancak burada önemi yoktur).
326325
327-
A directory structure could be like this:
326+
Bir klasör yapısı şöyle olabilir:
328327
```
329328
auth/
330329
index.js
@@ -338,15 +337,16 @@ auth/
338337
...
339338
```
340339
341-
We'd like to expose the package functionality via a single entry point, the "main file" `auth/index.js`, to be used like this:
340+
Paket işlevselliğini tek bir giriş noktası üzerinden göstermek istiyoruz, "ana dosya" `auth/index.js` böyle kullanılmalı,
342341
343342
```js
344343
import {login, logout} from 'auth/index.js'
345344
```
346345
347-
The idea is that outsiders, developers who use our package, should not meddle with its internal structure. They should not search for files inside our package folder. We export only what's necessary in `auth/index.js` and keep the rest hidden from prying eyes.
346+
Buradaki fikir, paketimizi kullanan geliştiricilerin iç yapısıyla karışmaması gerektiğidir. Paket klasörümüzdeki dosyaları aramamalılar. Sadece `auth/index.js`de gerekli olanları dışarıya aktarıyoruz ve gerisini meraklı gözlerden gizleriz.
348347
349-
Now, as the actual exported functionality is scattered among the package, we can gather and "re-export" it in `auth/index.js`:
348+
Şimdi, dışa aktarılan gerçek işlevsellik paketin arasına dağıl olduğundan, paket içinde "re-export" ve toplayabiliriz.
349+
`auth/index.js`:
350350
351351
```js
352352
// 📁 auth/index.js
@@ -361,12 +361,12 @@ export {Github};
361361
...
362362
```
363363
364-
"Re-exporting" is just a shorter notation for that:
364+
"Re-exporting" bunun için sadece kısa bir gösterimidir:
365365
366366
```js
367367
// 📁 auth/index.js
368368
export {login, logout} from './helpers.js';
369-
// or, to re-export all helpers, we could use:
369+
// ya da tüm yardımcıları re-export için kullanabiliriz.
370370
// export * from './helpers.js';
371371
372372
export {default as User} from './user.js';
@@ -376,17 +376,17 @@ export {default as Github} from './providers/github.js';
376376
```
377377
378378
````warn header="Re-exporting default is tricky"
379-
Please note: `export User from './user.js'` won't work. It's actually a syntax error. To re-export the default export, we must mention it explicitly `{default as ...}`, like in the example above.
379+
Lütfen unutmayın: `export User from './user.js'` çalışmayacak. Bu aslında sözdizimi hatası. Varsayılan içeriye aktarmayı re-export için açıkça belirtmeliyiz `{default as ...}`. Yukarıdaki örnekte olduğu gibi.
380380
381-
Also, there's another oddity: `export * from './user.js'` re-exports only named exports, excluding the default one. Once again, we need to mention it explicitly.
381+
Ayrıca, başka bir tuhaflık var: `export * from './user.js'` varsayılan olan haric, yalnızca adlandırılmış dışa aktarımlar yeniden dışa aktarılır. Bir kez daha açıkça söylemeliyiz.
382382
383-
For instance, to re-export everything, two statements will be necessary:
383+
Örneğin, her şeyi yeniden dışa aktarmak için iki ifade gerekli olacaktır:
384384
```js
385-
export * from './module.js'; // to re-export named exports
386-
export {default} from './module.js'; // to re-export default
385+
export * from './module.js'; // adlandırılmış dışarıya aktarımı yeniden dışarıya aktarmak için
386+
export {default} from './module.js'; // varsayılanı yeniden dışarıya aktarmak için
387387
```
388388
389-
The default should be mentioned explicitly only when re-exporting: `import * as obj` works fine. It imports the default export as `obj.default`. So there's a slight asymmetry between import and export constructs here.
389+
Varsayılan değer açıkça yalnızca yeniden dışa aktarırken belirtilmelidir `import * as obj` iyi çalışır. Varsayılan dışa aktarımı `obj.default` olarak alır. Yani burada içe aktarım ve dışa aktarım yapıları arasında hafif bir asimetri var.
390390
````
391391
392392
## Summary

0 commit comments

Comments
 (0)