React & JavaScript Essentials

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/53

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

54 Terms

1
New cards

What does it mean to 'Break UI into Components' in React?

It means dividing the UI into small reusable components that each receive props as inputs and output UI

2
New cards

What are props in React?

Props are inputs passed from a parent component to a child component

3
New cards

What is the component hierarchy in Thinking in React?

FilterableProductTable → SearchBar + ProductTable → ProductCategoryRow + ProductRow

4
New cards

What does this hierarchy tell you?

How data and UI are organized into nested components

5
New cards

What does 'Build a Static Version' mean?

Creating UI components that only use props and have no interactivity or state

6
New cards

In a static version

why can't users interact yet?

7
New cards

In this code

what does { product } mean: function ProductRow({ product }) { … }

8
New cards

What does the ternary operator condition ? a : b do?

It chooses between two values depending on whether the condition is true or false

9
New cards

In this code

what does represent?

10
New cards

What does style={{ color: 'red' }} mean?

It is an inline style using a JavaScript object inside JSX

11
New cards

What criteria make a value deserving of React state?

It changes over time

12
New cards

Why isn't the product list stored as state?

Because it's passed as props and does not change inside the component

13
New cards

What does 'Lift State Up' mean in React?

Moving shared state to the closest common parent component so children can access the same data

14
New cards

Why must SearchBar and ProductTable share state?

Because both depend on filterText and inStockOnly

15
New cards

What does this syntax mean: const [filterText

setFilterText] = useState('');

16
New cards

What initializes the state here?

The empty string '' passed into useState

17
New cards

What does onChange={(e) => onFilterTextChange(e.target.value)} do?

It updates state whenever the user types

18
New cards

What is e.target.value?

The text currently typed into the input field

19
New cards

In Tic-Tac-Toe

what three components is the UI split into?

20
New cards

Why is UI split this way?

To keep rendering logic simple and reusable

21
New cards

What does this state represent: ['X'

'O'

22
New cards

What does move history allow you to do?

Implement time travel to view previous game states

23
New cards

What does this do:

Creates an event handler that calls onSquareClick with the index of the clicked square

24
New cards

What does () => … mean in this context?

It creates an arrow function used as a click handler

25
New cards

Why must arrays be updated immutably in React?

Because mutating arrays directly breaks React's ability to detect changes

26
New cards

What is the difference between squares.slice() and […squares]?

Both create a shallow copy

27
New cards

What does this do: const [history

setHistory] = useState([Array(9).fill(null)]);

28
New cards

What does Array(9).fill(null) mean?

It creates an array of length 9 where every item is null

29
New cards

What does useState do in React?

It creates reactive component state and returns [stateValue

30
New cards

What does setCount(count + 1) do?

Updates count by creating a new value and triggering a rerender

31
New cards

What does useEffect handle?

Side effects like data fetching

32
New cards

What does the dependency array [count] mean?

The effect runs whenever the value 'count' changes

33
New cards

What does useRef store?

A mutable value or DOM reference that persists across renders

34
New cards

What does ref={inputRef} mean?

It binds a DOM element to inputRef so React can access it

35
New cards

What is useMemo used for?

Memoizing expensive calculations so they run only when dependencies change

36
New cards

What does useMemo(() => heavyCalc(items)

[items]) mean?

37
New cards

What does useCallback memoize?

Functions

38
New cards

What problem does useCallback help prevent?

Unnecessary re-renders in child components

39
New cards

What is the first rule of Hooks?

Only call hooks at the top level of a component

40
New cards

What is the second rule of Hooks?

Only call hooks inside React function components or custom hooks

41
New cards

What are React-DOM hooks used for?

Browser-specific tasks like forms

42
New cards

Why are React-DOM hooks rarely used by beginners?

They solve advanced DOM integration problems

43
New cards

What does spread syntax … do?

Expands arrays or objects into individual elements or properties

44
New cards

What is the opposite of spread syntax?

Rest syntax

45
New cards

What does […nums] do?

Creates a shallow copy of the nums array

46
New cards

What does [0

…nums] produce if nums = [1

47
New cards

What does { …base

c:3 } do?

48
New cards

What does …base mean inside an object literal?

Copies all enumerable properties from base

49
New cards

Why is spread syntax used in React state updates?

Because state must be immutable and spread creates a new array/object

50
New cards

What does setTodos([…todos

newTodo]) do?

51
New cards

What does function sum(…nums) mean?

Rest syntax that collects all arguments into the nums array

52
New cards

How is rest different from spread?

Rest collects into an array; spread expands an array

53
New cards

What is the best way to learn React?

Build things and recreate tutorials like Tic-Tac-Toe

54
New cards

Which three hooks make up 80% of React usage?

useState