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
> `React.PropTypes`has moved into a different package since React v15.5. Please use [the `prop-types`library instead](https://www.npmjs.com/package/prop-types).
11
+
> `React.PropTypes`React v15.5'ten bu yana farklı bir pakete taşındı. Lütfen bunun yerine [`prop-types`kütüphanesini kullanın](https://www.npmjs.com/package/prop-types).
12
12
>
13
-
>We provide [a codemod script](/blog/2017/04/07/react-v15.5.0.html#migrating-from-reactproptypes) to automate the conversion.
13
+
>Dönüştürme işlemini otomatikleştirmek için [bir codemod script](/blog/2017/04/07/react-v15.5.0.html#migrating-from-reactproptypes)'i sunuyoruz.
14
14
15
-
As your app grows, you can catch a lot of bugs with typechecking. For some applications, you can use JavaScript extensions like [Flow](https://flow.org/)or[TypeScript](https://www.typescriptlang.org/)to typecheck your whole application. But even if you don't use those, React has some built-in typechecking abilities. To run typechecking on the props for a component, you can assign the special `propTypes`property:
15
+
Uygulamanız büyüdükçe, tip kontrolü ile birçok hata yakalayabilirsiniz. Bazı uygulamalarda, tüm uygulamanız üzerinde tip kontrolü yapmak için [Flow](https://flow.org/)veya[TypeScript](https://www.typescriptlang.org/)gibi JavaScript uzantılarını kullanabilirsiniz. Ama bunları kullanmasanız bile, React bazı yerleşik tip kontrolü yeteneklerine sahiptir. Bir bileşenin prop'ları üzerinde tip kontrolü yapmak için, özel `propTypes`niteliğini atayabilirsiniz:
16
16
17
17
```javascript
18
18
importPropTypesfrom'prop-types';
@@ -30,18 +30,18 @@ Greeting.propTypes = {
30
30
};
31
31
```
32
32
33
-
`PropTypes`exports a range of validators that can be used to make sure the data you receive is valid. In this example, we're using `PropTypes.string`. When an invalid value is provided for a prop, a warning will be shown in the JavaScript console. For performance reasons, `propTypes`is only checked in development mode.
33
+
`PropTypes`alınan verilerin geçerli olduğundan emin olmak için kullanılabilecek bir dizi doğrulayıcı verir. Bu örnekte, `PropTypes.string`'i kullanıyoruz. Bir prop için geçersiz bir değer sağlandığında, JavaScript konsolunda bir uyarı gösterilecektir. Performans nedeniyle, `propTypes`sadece geliştirme modunda kontrol edilir.
34
34
35
35
### PropTypes {#proptypes}
36
36
37
-
Here is an example documenting the different validators provided:
37
+
İşte sağlanan çeşitli doğrulayıcıları gösteren bir örnek:
38
38
39
39
```javascript
40
40
importPropTypesfrom'prop-types';
41
41
42
42
MyComponent.propTypes= {
43
-
//You can declare that a prop is a specific JS type. By default, these
44
-
//are all optional.
43
+
//Bir prop'un belirli bir JS türü olduğunu belirtebilirsiniz.
44
+
//Varsayılan olarak, bunların hepsi isteğe bağlıdır.
45
45
optionalArray:PropTypes.array,
46
46
optionalBool:PropTypes.bool,
47
47
optionalFunc:PropTypes.func,
@@ -50,50 +50,50 @@ MyComponent.propTypes = {
50
50
optionalString:PropTypes.string,
51
51
optionalSymbol:PropTypes.symbol,
52
52
53
-
//Anything that can be rendered: numbers, strings, elements or an array
54
-
// (or fragment) containing these types.
53
+
//Render edilebilecek her şey: sayılar, dizeler, elemanlar veya bir dizi
54
+
// (veya fragment) bu türleri içeren.
55
55
optionalNode:PropTypes.node,
56
56
57
-
//A React element.
57
+
// React elemanı.
58
58
optionalElement:PropTypes.element,
59
59
60
-
//You can also declare that a prop is an instance of a class. This uses
61
-
// JS's instanceof operator.
60
+
//Bir prop'un sınıf nesnesi olduğunu da belirtebilirsiniz.
61
+
//Bu JS'in instanceof operatörünü kullanır.
62
62
optionalMessage:PropTypes.instanceOf(Message),
63
63
64
-
//You can ensure that your prop is limited to specific values by treating
65
-
//it as an enum.
66
-
optionalEnum:PropTypes.oneOf(['News', 'Photos']),
64
+
//Bir prop'un enum olarak değerlendirilerek
65
+
//belirli değerlerle sınırlı olmasını sağlayabilirsiniz.
You can define default values for your `props` by assigning to the special `defaultProps` property:
148
+
Özel `defaultProps` niteliğine atama yaparak, `prop`'larınız için varsayılan değerleri tanımlayabilirsiniz:
149
149
150
150
```javascript
151
151
classGreetingextendsReact.Component {
@@ -156,19 +156,19 @@ class Greeting extends React.Component {
156
156
}
157
157
}
158
158
159
-
//Specifies the default values for props:
159
+
//Prop'lar için varsayılan değerleri belirtir:
160
160
Greeting.defaultProps= {
161
161
name:'Stranger'
162
162
};
163
163
164
-
//Renders "Hello, Stranger":
164
+
// "Hello, Stranger" yazısını çıktılar:
165
165
ReactDOM.render(
166
166
<Greeting />,
167
167
document.getElementById('example')
168
168
);
169
169
```
170
170
171
-
If you are using a Babel transform like [transform-class-properties](https://babeljs.io/docs/plugins/transform-class-properties/), you can also declare`defaultProps` as static property within a React component class. This syntax has not yet been finalized though and will require a compilation step to work within a browser. For more information, see the [class fields proposal](https://github.com/tc39/proposal-class-fields).
171
+
Eğer [transform-class-properties](https://babeljs.io/docs/plugins/transform-class-properties/)gibi bir Babel dönüşümü kullanıyorsanız,`defaultProps`'u bir React bileşen sınıfında statik özellik olarak da tanımlayabilirsiniz. Bu sözdizimi henüz tamamlanmadı ve tarayıcıda çalışabilmesi için bir derleme adımı gerektirecektir. Daha fazla bilgi için, [sınıf alanları önergesi](https://github.com/tc39/proposal-class-fields)'ne göz atabilirsiniz.
172
172
173
173
```javascript
174
174
classGreetingextendsReact.Component {
@@ -184,4 +184,4 @@ class Greeting extends React.Component {
184
184
}
185
185
```
186
186
187
-
The `defaultProps` will be used to ensure that `this.props.name` will have a value if it was not specified by the parent component. The `propTypes` typechecking happens after `defaultProps`are resolved, so typechecking will also apply to the `defaultProps`.
187
+
`this.props.name`'in üst bileşen tarafından belirtilen bir değerinin olmadığı durumlarda, varsayılan bir değere sahip olmasını sağlamak için `defaultProps` kullanılır. `propTypes` tip kontrolü `defaultProps`çözümlendikten sonra gerçekleşir, bu nedenle tip kontrolü `defaultProps` için de geçerli olacaktır.
0 commit comments