Skip to content

Commit 7bb3157

Browse files
committed
remove mentions of old contents
1 parent cc1d123 commit 7bb3157

File tree

7 files changed

+29
-48
lines changed

7 files changed

+29
-48
lines changed

src/components/layout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const Layout = props => {
3939

4040
<Header lang={siteLanguage} />
4141

42-
<InfoBanner onHide={() => hideNote()} visible={visible} />
42+
<InfoBanner onHide={() => hideNote()} visible={false} />
4343

4444
<main id="main-content">{children}</main>
4545

src/content/10/en/part10.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ In this part, we will learn how to build native Android and iOS mobile applicati
1010

1111
<i>Part updated 26th Feb 2024</i>
1212
- <i>New Node 20 version of rate-repository-api</i>
13-
- <i>Material updated in parts 10a, 10b and 10c</i>
14-
15-
Note: Some updates are not compatible anymore with material before Feb 2024.
16-
We recommend a fresh start with this new Part 10 material you're reading now. However, if you´re returning to this course after a break, and you want to continue the exercises in your older project, please use [Part 10 material before the update](https://github.com/fullstack-hy2020/fullstack-hy2020.github.io/tree/e9784f36de8a0badc28fabde49e33e2959479177/src/content/10/en).
17-
13+
- <i>Material updated</i>
1814

1915
</div>

src/content/10/en/part10b.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ lang: en
77

88
<div class="content">
99

10-
Note: This course material was updated in Feb 2024. Some updates are not compatible anymore with older material.
11-
We recommend a fresh start with this new Part 10 material. However, if you´re returning to this course after a break, and you want to continue the exercises in your older project, please use [Part 10 material before the upgrade](https://github.com/fullstack-hy2020/fullstack-hy2020.github.io/tree/e9784f36de8a0badc28fabde49e33e2959479177/src/content/10/en).
12-
13-
1410
Now that we have set up our development environment we can get into React Native basics and get started with the development of our application. In this section, we will learn how to build user interfaces with React Native's core components, how to add style properties to these core components, how to transition between views, and how to manage the form's state efficiently.
1511

1612
### Core components

src/content/10/en/part10c.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ lang: en
77

88
<div class="content">
99

10-
Note: This course material was updated in Feb 2024. Some updates are not compatible anymore with older material.
11-
We recommend a fresh start with this new Part 10 material. However, if you´re returning to this course after a break, and you want to continue the exercises in your older project, please use [Part 10 material before the upgrade](https://github.com/fullstack-hy2020/fullstack-hy2020.github.io/tree/e9784f36de8a0badc28fabde49e33e2959479177/src/content/10/en).
12-
1310
So far we have implemented features to our application without any actual server communication. For example, the reviewed repositories list we have implemented uses mock data and the sign in form doesn't send the user's credentials to any authentication endpoint. In this section, we will learn how to communicate with a server using HTTP requests, how to use Apollo Client in a React Native application, and how to store data in the user's device.
1411

1512
Soon we will learn how to communicate with a server in our application. Before we get to that, we need a server to communicate with. For this purpose, we have a completed server implementation in the [rate-repository-api](https://github.com/fullstack-hy2020/rate-repository-api) repository. The rate-repository-api server fulfills all our application's API needs during this part. It uses [SQLite](https://www.sqlite.org/index.html) database which doesn't need any setup and provides an Apollo GraphQL API along with a few REST API endpoints.

src/content/5/en/part5c.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,6 @@ letter: c
55
lang: en
66
---
77

8-
<div class="tasks">
9-
10-
The test library used in this part was changed on March 3, 2024 from Jest to Vitest. If you already started this part using Jest, you can see [here](https://github.com/fullstack-hy2020/fullstack-hy2020.github.io/blob/02d8be28b1c9190f48976fbbd2435b63261282df/src/content/5/en/part5c.md) the old content.
11-
12-
</div>
13-
148
<div class="content">
159

1610
There are many different ways of testing React applications. Let's take a look at them next.

src/content/9/en/part9d.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export default App;
222222
223223
and remove the unnecessary files.
224224
225-
The whole app is now in one component. That is not what we want, so refactor the code so that it consists of three components: *Header*, *Content* and *Total*. All data is still kept in the *App* component, which passes all necessary data to each component as props. *Be sure to add type declarations for each component's props!*
225+
The whole app is now in one component. That is not what we want, so refactor the code so that it consists of three components: *Header*, *Content* and *Total*. All data is still kept in the *App* component, which passes all necessary data to each component as props. <i>Be sure to add type declarations for each component's props!</i>
226226
227227
The *Header* component should take care of rendering the name of the course. *Content* should render the names of the different parts and the number of exercises in each part, and *Total* should render the total sum of exercises in all parts.
228228
@@ -409,15 +409,15 @@ If we try to access the objects in the array *courseParts: CoursePart[]* we noti
409409
410410
And indeed, the TypeScript [documentation](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#working-with-union-types) says this:
411411
412-
> *TypeScript will only allow an operation (or attribute access) if it is valid for every member of the union.*
412+
> <i>TypeScript will only allow an operation (or attribute access) if it is valid for every member of the union.</i>
413413
414414
The documentation also mentions the following:
415415
416-
> *The solution is to narrow the union with code... Narrowing occurs when TypeScript can deduce a more specific type for a value based on the structure of the code.*
416+
> <i>The solution is to narrow the union with code... Narrowing occurs when TypeScript can deduce a more specific type for a value based on the structure of the code.</i>
417417
418418
So once again the [type narrowing](https://www.typescriptlang.org/docs/handbook/2/narrowing.html) is the rescue!
419419
420-
One handy way to narrow these kinds of types in TypeScript is to use *switch case* expressions. Once TypeScript has inferred that a variable is of union type and that each type in the union contain a certain literal attribute (in our case *kind*), we can use that as a type identifier. We can then build a switch case around that attribute and TypeScript will know which attributes are available within each case block:
420+
One handy way to narrow these kinds of types in TypeScript is to use *switch case* expressions. Once TypeScript has inferred that a variable is of union type and that each type in the union contains a certain literal attribute (in our case *kind*), we can use that as a type identifier. We can then build a switch case around that attribute and TypeScript will know which attributes are available within each case block:
421421
422422
![vscode showing part. and then the attributes](../../images/9/64new.png)
423423
@@ -665,7 +665,7 @@ import { useState } from "react";
665665

666666
const App = () => {
667667
const [notes, setNotes] = useState<Note[]>([
668-
{ id: 1, content: 'testing' } // highlight-line
668+
{ id: '1', content: 'testing' } // highlight-line
669669
]);
670670
const [newNote, setNewNote] = useState('');
671671

@@ -847,7 +847,7 @@ We can now set the data in the state *notes* to get the code working:
847847
848848
So just like with *useState*, we gave a type parameter to *axios.get* to instruct it on how the typing should be done. Just like *useState* also *axios.get* is a [generic function](https://www.typescriptlang.org/docs/handbook/2/generics.html#working-with-generic-type-variables). Unlike some generic functions, the type parameter of *axios.get* has a default value of *any* so, if the function is used without defining the type parameter, the type of the response data will be any.
849849
850-
The code works, compiler and Eslint are happy and remain quiet. However, giving a type parameter to *axios.get* is a potentially dangerous thing to do. The response body can contain data in an arbitrary form, and when giving a type parameter we are essentially just telling to TypeScript compiler to trust us that the data has type *Note[]*.
850+
The code works, compiler and Eslint are happy and remain quiet. However, giving a type parameter to *axios.get* is a potentially dangerous thing to do. The <i>response body can contain data in an arbitrary form</i>, and when giving a type parameter we are essentially just telling to TypeScript compiler to trust us that the data has type *Note[]*.
851851
852852
So our code is essentially as safe as it would be if a [type assertion](/en/part9/first_steps_with_type_script#type-assertion) would be used:
853853
@@ -860,9 +860,9 @@ So our code is essentially as safe as it would be if a [type assertion](/en/part
860860
}, [])
861861
```
862862
863-
Since the TypeScript types do not even exist in runtime, our code does not give us any "safety" against situations where the request body contains data in a wrong form.
863+
Since the TypeScript types do not even exist in runtime, our code does not give us any safety against situations where the request body contains data in the wrong form.
864864
865-
Giving a type parameter to *axios.get* might be ok if we are *absolutely sure* that the backend behaves correctly and returns always the data in the correct form. If we want to build a robust system we should prepare for surprises and parse the response data in the frontend, similarly to what we did [in the previous section](/en/part9/typing_an_express_app#proofing-requests) for the requests to the backend.
865+
Giving a type parameter to *axios.get* might be ok if we are <i>absolutely sure</i> that the backend behaves correctly and returns always the data in the correct form. If we want to build a robust system we should prepare for surprises and parse the response data in the frontend, similarly to what we did [in the previous section](/en/part9/typing_an_express_app#proofing-requests) for the requests to the backend.
866866
867867
Let us now wrap up our app by implementing the new note addition:
868868

0 commit comments

Comments
 (0)