React · Lesson 66 of 120
Patterns Quiz
Test yourself.
Let's review TypeScript and patterns. Pause after each question, and answer before I do.
- Patterns quiz
- Pause and think
- Then check
Question 1
How do you give use state a union type? Pass it in angle brackets.
Quick check
For a union type in state:
Question 2
How should a filtered list be produced? Derived from state while rendering.
Quick check
A filtered list is best:
Question 3
Why copy an array before sorting it? Because sort changes the array in place.
Quick check
Copy before sort because:
Question 4
Which prop lets a component accept any content inside it? Children.
Quick check
Content between tags arrives as:
Summary
Well done. Next, a new section on routing.
Key takeaways- Typed state
- Derived lists
- Composition
Next up: Routing — pages in one app