@@ -60,7 +60,7 @@ Anyone?
60
60
61
61
---
62
62
63
- ### What does it look like ?
63
+ ### What is a component ?
64
64
65
65
``` jsx
66
66
const App = () => (
@@ -178,12 +178,15 @@ Start your project here! ️
178
178
179
179
️➡️ https://stackblitz.com/fork/typescript-react-starter
180
180
181
+ OR
182
+
183
+ ️➡️ https://codesandbox.io/s/
181
184
182
185
---
183
186
184
187
### Exercise 1
185
188
186
- Create static JSX elements for:
189
+ Create JSX / HTML elements for:
187
190
- Time (mm: hh )
188
191
- Start / stop button
189
192
- New lap button
@@ -193,6 +196,18 @@ Create static JSX elements for:
193
196
194
197
---
195
198
199
+ ### Exercise 1 - Hints
200
+
201
+ ``` jsx
202
+ < div style= {{ backgroundColor: ' blue' }}>< / div>
203
+ < button> My button< / button>
204
+ ```
205
+
206
+ <center >
207
+ <img src =" assets/stopwatch.png " height =" 100 " style =" text-align : center ; margin-top : 20px " />
208
+ </center >
209
+
210
+ ---
196
211
### Conditionals
197
212
198
213
``` jsx
@@ -252,7 +267,7 @@ const App = () => (
252
267
253
268
- Typesafety inside your views
254
269
- Definitions of your ` props ` and ` state `
255
- - No need of ` PropTypes `
270
+ - No need for ` PropTypes `
256
271
257
272
---
258
273
@@ -266,6 +281,8 @@ const App = () => (
266
281
### State example 0
267
282
268
283
``` jsx
284
+ import { useState } from ' react'
285
+
269
286
const App: FC = () => {
270
287
const [username , setUsername ] = useState (' ' )
271
288
return (
@@ -285,6 +302,8 @@ const App: FC = () => {
285
302
### State example 1
286
303
287
304
``` jsx
305
+ import { useState } from ' react'
306
+
288
307
const App = () => {
289
308
const [isLoading , setIsLoading ] = useState (true )
290
309
@@ -302,6 +321,8 @@ const App = () => {
302
321
### State example 2
303
322
304
323
``` jsx
324
+ import { useState } from ' react'
325
+
305
326
const App = () => {
306
327
const [user , setUser ] = useState< User | false > (false )
307
328
@@ -386,6 +407,8 @@ Use the created setters for:
386
407
### On mount
387
408
388
409
``` jsx
410
+ import { useEffect } from ' react'
411
+
389
412
const App = () => {
390
413
391
414
useEffect (() => {
@@ -401,6 +424,8 @@ const App = () => {
401
424
### On props / state update
402
425
403
426
``` jsx
427
+ import { useEffect } from ' react'
428
+
404
429
const App = () => {
405
430
406
431
useEffect (() => {
@@ -415,6 +440,8 @@ const App = () => {
415
440
### On specific prop / state update
416
441
417
442
``` jsx
443
+ import { useState , useEffect } from ' react'
444
+
418
445
const App = props => {
419
446
const [isLoading , setIsLoading ] = useState (true )
420
447
0 commit comments