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
@@ -18,7 +18,7 @@ TypeScript is a popular way to add type definitions to JavaScript codebases. Out
18
18
19
19
</YouWillLearn>
20
20
21
-
## Installation {/*installation*/}
21
+
## Asennus {/*installation*/}
22
22
23
23
All [production-grade React frameworks](https://react-dev-git-fork-orta-typescriptpage-fbopensource.vercel.app/learn/start-a-new-react-project#production-grade-react-frameworks) offer support for using TypeScript. Follow the framework specific guide for installation:
24
24
@@ -27,7 +27,7 @@ All [production-grade React frameworks](https://react-dev-git-fork-orta-typescri
The type describing your component's props can be as simple or as complex as you need, though they should be an object type described with either a `type` or `interface`. You can learn about how TypeScript describes objects in [Object Types](https://www.typescriptlang.org/docs/handbook/2/objects.html) but you may also be interested in using [Union Types](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#union-types) to describe a prop that can be one of a few different types and the [Creating Types from Types](https://www.typescriptlang.org/docs/handbook/2/types-from-types.html) guide for more advanced use cases.
123
123
124
124
125
-
## Example Hooks {/*example-hooks*/}
125
+
## Hookki-esimerkkejä {/*example-hooks*/}
126
126
127
127
The type definitions from `@types/react` include types for the built-in hooks, so you can use them in your components without any additional setup. They are built to take into account the code you write in your component, so you will get [inferred types](https://www.typescriptlang.org/docs/handbook/type-inference.html) a lot of the time and ideally do not need to handle the minutiae of providing the types.
128
128
@@ -371,11 +371,11 @@ export default function Form() {
371
371
}
372
372
```
373
373
374
-
## Useful Types {/*useful-types*/}
374
+
## Hyödyllisiä tyyppejä {/*useful-types*/}
375
375
376
376
There is quite an expansive set of types which come from the `@types/react` package, it is worth a read when you feel comfortable with how React and TypeScript interact. You can find them [in React's folder in DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts). We will cover a few of the more common types here.
377
377
378
-
### DOM Events {/*typing-dom-events*/}
378
+
### DOM tapahtumat {/*typing-dom-events*/}
379
379
380
380
When working with DOM events in React, the type of the event can often be inferred from the event handler. However, when you want to extract a function to be passed to an event handler, you will need to explicitly set the type of the event.
381
381
@@ -437,7 +437,7 @@ Note, that you cannot use TypeScript to describe that the children are a certain
437
437
438
438
You can see all an example of both `React.ReactNode` and `React.ReactElement` with the type-checker in [this TypeScript playground](https://www.typescriptlang.org/play?#code/JYWwDg9gTgLgBAJQKYEMDG8BmUIjgIilQ3wChSB6CxYmAOmXRgDkIATJOdNJMGAZzgwAFpxAR+8YADswAVwGkZMJFEzpOjDKw4AFHGEEBvUnDhphwADZsi0gFw0mDWjqQBuUgF9yaCNMlENzgAXjgACjADfkctFnYkfQhDAEpQgD44AB42YAA3dKMo5P46C2tbJGkvLIpcgt9-QLi3AEEwMFCItJDMrPTTbIQ3dKywdIB5aU4kKyQQKpha8drhhIGzLLWODbNs3b3s8YAxKBQAcwXpAThMaGWDvbH0gFloGbmrgQfBzYpd1YjQZbEYARkB6zMwO2SHSAAlZlYIBCdtCRkZpHIrFYahQYQD8UYYFA5EhcfjyGYqHAXnJAsIUHlOOUbHYhMIIHJzsI0Qk4P9SLUBuRqXEXEwAKKfRZcNA8PiCfxWACecAAUgBlAAacFm80W-CU11U6h4TgwUv11yShjgJjMLMqDnN9Dilq+nh8pD8AXgCHdMrCkWisVoAet0R6fXqhWKhjKllZVVxMcavpd4Zg7U6Qaj+2hmdG4zeRF10uu-Aeq0LBfLMEe-V+T2L7zLVu+FBWLdLeq+lc7DYFf39deFVOotMCACNOCh1dq219a+30uC8YWoZsRyuEdjkevR8uvoVMdjyTWt4WiSSydXD4NqZP4AymeZE072ZzuUeZQKheQgA).
439
439
440
-
### Style Props {/*typing-style-props*/}
440
+
### Tyylipropsit {/*typing-style-props*/}
441
441
442
442
When using inline styles in React, you can use `React.CSSProperties` to describe the object passed to the `style` prop. This type is a union of all the possible CSS properties, and is a good way to ensure you are passing valid CSS properties to the `style` prop, and to get auto-complete in your editor.
443
443
@@ -447,7 +447,7 @@ interface MyComponentProps {
447
447
}
448
448
```
449
449
450
-
## Further learning {/*further-learning*/}
450
+
## Lisää opeteltavaa {/*further-learning*/}
451
451
452
452
This guide has covered the basics of using TypeScript with React, but there is a lot more to learn.
453
453
Individual API pages on the docs may contain more in-depth documentation on how to use them with TypeScript.
0 commit comments