Skip to content

Commit ee4f9ab

Browse files
author
Martin van Dam
committed
Optimise slides
1 parent 9e3f70b commit ee4f9ab

File tree

1 file changed

+30
-3
lines changed

1 file changed

+30
-3
lines changed

presentation/react.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Anyone?
6060

6161
---
6262

63-
### What does it look like?
63+
### What is a component?
6464

6565
```jsx
6666
const App = () => (
@@ -178,12 +178,15 @@ Start your project here! ️
178178

179179
️➡️ https://stackblitz.com/fork/typescript-react-starter
180180

181+
OR
182+
183+
️➡️ https://codesandbox.io/s/
181184

182185
---
183186

184187
### Exercise 1
185188

186-
Create static JSX elements for:
189+
Create JSX / HTML elements for:
187190
- Time (mm:hh)
188191
- Start / stop button
189192
- New lap button
@@ -193,6 +196,18 @@ Create static JSX elements for:
193196

194197
---
195198

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+
---
196211
### Conditionals
197212

198213
```jsx
@@ -252,7 +267,7 @@ const App = () => (
252267

253268
- Typesafety inside your views
254269
- Definitions of your `props` and `state`
255-
- No need of `PropTypes`
270+
- No need for `PropTypes`
256271

257272
---
258273

@@ -266,6 +281,8 @@ const App = () => (
266281
### State example 0
267282

268283
```jsx
284+
import { useState } from 'react'
285+
269286
const App: FC = () => {
270287
const [username, setUsername] = useState('')
271288
return (
@@ -285,6 +302,8 @@ const App: FC = () => {
285302
### State example 1
286303

287304
```jsx
305+
import { useState } from 'react'
306+
288307
const App = () => {
289308
const [isLoading, setIsLoading] = useState(true)
290309

@@ -302,6 +321,8 @@ const App = () => {
302321
### State example 2
303322

304323
```jsx
324+
import { useState } from 'react'
325+
305326
const App = () => {
306327
const [user, setUser] = useState<User | false>(false)
307328

@@ -386,6 +407,8 @@ Use the created setters for:
386407
### On mount
387408

388409
```jsx
410+
import { useEffect } from 'react'
411+
389412
const App = () => {
390413

391414
useEffect(() => {
@@ -401,6 +424,8 @@ const App = () => {
401424
### On props / state update
402425

403426
```jsx
427+
import { useEffect } from 'react'
428+
404429
const App = () => {
405430

406431
useEffect(() => {
@@ -415,6 +440,8 @@ const App = () => {
415440
### On specific prop / state update
416441

417442
```jsx
443+
import { useState, useEffect } from 'react'
444+
418445
const App = props => {
419446
const [isLoading, setIsLoading] = useState(true)
420447

0 commit comments

Comments
 (0)