Basics Flashcards

1
Q

What is React?

A

React is a declarative, efficient, and flexible JaveScript library for building user interfaces. It lets you compose complex UIs from small and isolated pieces of code called “components”.

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

What do components do and what happens when data changes?

A

Q: What do components do and what happens when data changes?

We use components to tell React what we want to see on the screen. When our data changes, React will efficiently update and re-render our components.

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

What does a component take as parameters and what does it return?

A

Q: What does a component take as parameters and what does it return?

A component takes in parameters called props(short for properties) and returns a hierarchy of views to display via the render method.

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

What does the render method return?

A

Q: What does the render method return?

The render method returns a description of what you want to see on the screen. React takes the description and displays the result. In particular, render returns a React element, which is a lightweight description of what to render.

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

What can you put inside JSX braces?

A

Q: What can you put inside JSX braces?

You can put any JavaScript expressions within braces inside JSX. Each React element is a JavaScript object that you can store in a variable or pass around in your program.

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

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

A

By using the props object. Passing props is how info flows in React apps, from parents to children.

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

How do components “remember “ things?

A

Q: How do components “remember “ things?

By using state.

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

How can React components have state?

A

Q: How can React components have state?

BY setting this.state in their constructors. this.state should be considered private to a React component that it’s defined in.

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

What do you always need to do when defining the constructor of a subclass?

A

You always need to call super(props) when defining the constructor of a subclass. All React component classes that have a constructor should start with a super(props) call

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

What does React Dev Tools do?

A

The React Dev Tools let you check the props and state of your React components.

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

What does the Components tab do in React Dev Tools?

A

Q: What does the Components tab do in React Dev Tools?

The Components tab allows you to inspect the component tree.

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

Why lift up state?

A

To collect data from multiple children, or to have two child components communicate with each other, you need to declare the shared state in their parent component. The parent component can pass the state back down to the children by using props: this keeps the child components in sync with each other and with the parent component.

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