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
{{ message }}
This repository was archived by the owner on Nov 16, 2023. It is now read-only.
Copy file name to clipboardExpand all lines: step2-01/demo/README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Step 2.1: Introduction to TypeScript (Demo)
1
+
# Step 2.1 - Introduction to TypeScript (Demo)
2
2
3
3
[Lessons](../../) | [Exercise](../exercise/)
4
4
@@ -28,11 +28,11 @@ The most important ones to know about are:
28
28
29
29
> For more information about the _many_ modularity patterns and standards developed over time, see [this article](https://medium.freecodecamp.org/javascript-modules-a-beginner-s-guide-783f7d7a5fcc). You may still encounter some of the older patterns in legacy code.
30
30
31
-
## TypeScript Types
31
+
## TypeScript types
32
32
33
33
Refer to [`demo/src/types`](./src/types/index.ts) for examples of some of the types available in TS that benefit a React developer.
34
34
35
-
## Spread Operator
35
+
## Spread operator
36
36
37
37
The spread operator `...` provides a quick way to clone and concatenate objects and arrays. This syntax is seen a lot inside React props and Redux reducers.
38
38
@@ -139,7 +139,7 @@ aPromise
139
139
140
140
> For more information, see [this overview of promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises) or [this deep dive](https://developers.google.com/web/fundamentals/primers/promises).
141
141
142
-
## Async / Await
142
+
## Async / await
143
143
144
144
**Async / Await** is a language-level feature for writing asynchronous functions as if they are ordinary, synchronous code. JS support for this is built on top of `Promise`s and is inspired heavily by [C#'s async / await syntax](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/async/). An async function is written like this:
Copy file name to clipboardExpand all lines: step2-01/exercise/README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Step 2.1: Introduction to TypeScript (Exercise)
1
+
# Step 2.1 - Introduction to TypeScript (Exercise)
2
2
3
3
[Lessons](../../) | [Demo](../demo/)
4
4
@@ -20,7 +20,7 @@ Exercises will be completed under this step's `exercise/src` folder unless other
20
20
21
21
5. Inside `index.ts` in the same folder, import both `fib` and `FibConst`, and use the built-in `console.log()` function to log the result of `fib(FibConst)`.
22
22
23
-
## Types and Interfaces
23
+
## Types and interfaces
24
24
25
25
Inside `exercise/src/index.ts`:
26
26
@@ -38,7 +38,7 @@ Inside `exercise/src/stack.ts`, create a generic class for a `Stack<T>` complete
38
38
39
39
In `exercise/src/index.ts`, create a `Stack<number>` and use `console.log()` to demonstrate its functionality.
40
40
41
-
## Spread and Destructuring
41
+
## Spread and destructuring
42
42
43
43
1. Note the following code in index.ts:
44
44
@@ -61,7 +61,7 @@ const obj2 = {
61
61
62
62
3. Use the destructuring syntax to retrieve the values for `{first, second, catcher}` from `megaObj`.
Copy file name to clipboardExpand all lines: step2-03/exercise/README.md
+6-8Lines changed: 6 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,10 @@
1
-
# Step 2.3: Theming and styling with UI Fabric (Exercise)
1
+
# Step 2.3 - Theming and styling with UI Fabric (Exercise)
2
2
3
3
[Lessons](../../) | [Demo](../demo/)
4
4
5
5
If you don't already have the app running, start it by running `npm start` from the root of the `frontend-bootcamp` folder. Click the "exercise" link under day 2 step 3 to see results.
6
6
7
-
## Fabric theming and styling
8
-
9
-
### Applying Fabric themes
7
+
## Applying Fabric themes
10
8
11
9
Try applying some predefined themes from UI Fabric packages inside the TodoApp under `exercise/src/components/TodoApp.tsx`. Do this by replacing:
1. Create your own theme using the [theme generator](https://developer.microsoft.com/en-us/fabric#/styles/themegenerator) and copy the generated code.
26
24
@@ -30,7 +28,7 @@ import { TeamsCustomizations } from '@uifabric/theme-samples';
30
28
31
29
4. Play around with the values and use VS Code's intellisense to discover more properties of the `ITheme` type.
32
30
33
-
###Customizing one Fabric control instance
31
+
## Customizing one Fabric control instance
34
32
35
33
1. Open `exercise/src/components/TodoFooter.tsx`
36
34
@@ -40,9 +38,9 @@ import { TeamsCustomizations } from '@uifabric/theme-samples';
40
38
41
39
4. Try to customize this with a styles function
42
40
43
-
## Advanced/non-Fabric component styling
41
+
## CSS-in-JS with `mergeStyles`
44
42
45
-
### CSS-in-JS with `mergeStyles`
43
+
As mentioned in the demo, this is an advanced approach which also works outside of Fabric. You wouldn't typically use this approach within a Fabric-based app.
46
44
47
45
1. Try generating a class name using `mergeStyles` and use it as a `className` prop inside `TodoApp`
Copy file name to clipboardExpand all lines: step2-04/demo/README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,8 +8,8 @@ We will solve these problems with the [React Context API](https://reactjs.org/do
8
8
9
9
1. The problem of complex applications
10
10
2. React Context API
11
-
3. Consuming context from a Class Component
12
-
4. Consuming context from a Functional Component
11
+
3. Consuming context from a class component
12
+
4. Consuming context from a functional component
13
13
14
14
## The problem of complex applications
15
15
@@ -81,7 +81,7 @@ class TodoApp extends React.Component {
81
81
}
82
82
```
83
83
84
-
### Consume context from a Class Component
84
+
### Consume context from a class component
85
85
86
86
Inside a class-based child component, such as `<TodoHeader>`, the context created in the parent can be accessed via `this.context`. Note that for this to work, you must also set the component class's `contextType` property to the context type created above.
87
87
@@ -97,7 +97,7 @@ class TodoHeader extends React.Component {
97
97
TodoHeader.contextType= TodoContext;
98
98
```
99
99
100
-
### Consume context from a Functional Component
100
+
### Consume context from a functional component
101
101
102
102
If you're using the functional component syntax, you can access the context with the `useContext()` hook:
Copy file name to clipboardExpand all lines: step2-04/exercise/README.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,19 +4,19 @@
4
4
5
5
If you don't already have the app running, start it by running `npm start` from the root of the `frontend-bootcamp` folder. Click the "exercise" link under day 2 step 4 to see results.
6
6
7
-
## TodoContext.Provider Component
7
+
## TodoContext.Provider component
8
8
9
9
1. Open `exercise/src/components/TodoApp.tsx`
10
10
11
11
2. Uncomment the missing functions inside the value prop
If you don't already have the app running, start it by running `npm start` from the root of the `frontend-bootcamp` folder. Click the "exercise" link under day 2 step 5 to see results.
6
6
7
7
1. First, take a look at the store interface in `exercise/src/store/index.ts`. Note that the `Store` interface has two keys: `todos` and `filter`. We'll concentrate on `todos`, which is an object where the keys are string IDs and the values are of type `TodoItem`.
8
8
9
-
2. Open `exercise/src/reducers/index.ts` and fill in the missing case statements for the switch on `action.type`.
9
+
2. Open `exercise/src/reducers/index.ts` and fill in the missing reducer implementations.
10
10
11
-
3. Open `exercise/src/index.tsx` and write separate dispatch calls.
11
+
3. Open `exercise/src/index.tsx` and write some `dispatch` calls.
12
12
13
-
4. Take a look what is written in the console (F12 on PC, cmd-option-I on Mac).
13
+
4. Take a look what is written in the console (F12 on PC, `cmd-option-I` on Mac).
14
14
15
-
5. Install the Redux DevTools [Chrome](https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd) or [Firefox](https://addons.mozilla.org/en-US/firefox/addon/reduxdevtools/)extensions
15
+
5. Install the Redux DevTools [Chrome](https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd) or [Firefox](https://addons.mozilla.org/en-US/firefox/addon/reduxdevtools/)extension
16
16
17
17
6. Observe the state changes and try doing "time travel"
0 commit comments