React Foundations Flashcards

(20 cards)

1
Q

What is React?

A

A JavaScript library for building user interfaces

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

What is JSX?

A

A syntax extension for JavaScript that lets you write HTML-like code in React.

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

What is a component in React?

A

An independent

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

What is the difference between functional and class components?

A

Functional components are simpler and use hooks; class components use lifecycle methods.

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

What is state in React?

A

A built-in object that stores property values that belong to a component.

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

What is a prop in React?

A

Short for properties

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

How do you pass data from a parent to a child component?

A

By using props.

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

What is useState used for?

A

To declare and update state in functional components.

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

What is useEffect used for?

A

To handle side effects such as data fetching

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

What happens when state is updated?

A

React re-renders the component to reflect the new state.

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

What is the virtual DOM?

A

A lightweight copy of the real DOM used by React to improve performance.

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

What is the key prop and why is it important?

A

It helps React identify which items have changed in a list.

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

Can props be changed inside a component?

A

No

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

What is lifting state up?

A

Moving state to a common ancestor to share it between components.

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

What does conditional rendering mean in React?

A

Rendering components or elements based on a condition.

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

How do you handle events in React?

A

Using camelCase syntax and passing functions

17
Q

What is a controlled component?

A

A form input element controlled by React state.

18
Q

What is the difference between controlled and uncontrolled components?

A

Controlled components are tied to state; uncontrolled components use refs and manage their own state.

19
Q

How do you perform form validation in React?

A

By controlling input values via state and adding custom validation logic.

20
Q

What does ReactDOM.render() do?

A

It renders a React element into the DOM in the supplied container.