React.js beginner cards that might be asked in an interview Flashcards

1
Q

What is React.js?

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

True or False: React is a framework.

A

False

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

What are components in React?

A

Reusable pieces of code that return a React element.

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

Fill in the blank: In React, state is an object that determines the ______ of a component.

A

data and behavior

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

What is the purpose of props in React?

A

To pass data from parent components to child components.

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

What does JSX stand for?

A

JavaScript XML

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

What is a class component?

A

A component defined as a JavaScript class.

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

What is a functional component?

A

A component defined as a JavaScript function.

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

True or False: React components can be nested.

A

True

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

What is the use of the useState hook?

A

To add state to functional components.

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

What is the significance of the render method?

A

In class components, it defines what the UI looks like by returning JSX.

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

What does the useEffect hook do?

A

It allows you to perform side effects in functional components.

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

What is the virtual DOM?

A

An in-memory representation of the real DOM.

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

Fill in the blank: The ______ method is called when a component is first added to the DOM.

A

componentDidMount (for class components) or useEffect with an empty dependency array (for functional components).

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

What are keys in React?

A

Unique identifiers for elements in a list.

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

What is prop drilling?

A

Passing data through multiple layers of components.

17
Q

True or False: React uses a one-way data binding.

18
Q

What is a higher-order component?

A

A function that takes a component and returns a new component.

19
Q

What is the purpose of the useContext hook?

A

To access context data in functional components.

20
Q

What is a controlled component?

A

A form component where the input value is controlled by React state.

21
Q

What is the purpose of the shouldComponentUpdate lifecycle method?

A

In class components, it determines whether a component should re-render. In functional components, use React.memo.

22
Q

Fill in the blank: React uses ______ to manage the UI updates.

A

reconciliation

23
Q

What is the purpose of the useReducer hook?

A

To manage complex state logic in functional components.

24
Q

What is the difference between state and props?

A

State is local and managed within the component, while props are passed from parent to child.

25
Q

What are fragments in React?

A

A way to group multiple elements without adding extra nodes to the DOM.

26
Q

True or False: React can be used for mobile app development.