Thinking in React Flashcards

(8 cards)

1
Q

What’s a functional component?

A

A functional component is a TS/JS function that takes props and returns JSX

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does JSX work?

A

JSX works by wrapping functioning JS in syntactic sugar, giving it the appearance of HTML while returning valid JS.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What’s the difference between a prop & a state?

A

A state is data managed in a component, it’s mutable & private. A prop is data passed into a component from a parent, it’s immutable by the child.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is Declarative Rendering Logic?

A

A programming paradigm where you declare what the UI should look like based on the current state, and the framework handles the how of updating the UI

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the main conditional rendering operators?

A

The ternary operator ( ?: ) and the LOGICAL AND operator ( && )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you handle events?

A

You have a camel case function that you pass in to the event handler without calling it.

<button onClick={turnOn}>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do foundational hooks relate to declarative rendering logic?

A

Declarative rendering logic describes what the UI should render, foundational hooks allow the states we render to be dynamic.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What should I remember about state hooks? (What can’t you do to the state variable, and what should you do when updating the state based on the old state)

A
  1. You can’t modify the state variable directly
  2. When updating the state based on the old state, you should pass in an update function.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly