Introduction to React Flashcards

1
Q

What is React?

A

Raect is a JS library for building front-end application and UI.

It allows us to create reusable components that manange their own state then compose them to create comples UI’s.

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

It is an officially supported way to create single paged React applications.

It offers a modern build setrip with no configuration.

A

Create-React-App

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

What is a React Component?

A

The building block of any React app.

  1. Lets you break up the user interface into separate pieces that can be reused and handled independently
  2. Can be defined as a Function or a Class
  3. Takes in an optional input (prop) and returns a JSX which is renderd on the screen.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a React class component?

A
  1. it has to extend React.Component
  2. requires a render method which teturns JSX
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a State?

A

A State contains data specific to its component and may change over time

  1. When the State changes the component re-renders
  2. It can contain as many properties as you like
  3. To change the State we use this.setState()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is a Prop?

A

Stands for properties

  1. Used for passing data fro one component to another.
  2. Data with props are beign passed in a uni-directional flow ( one way from parent to child)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are dev tools used for?

A

Its a Chrome dev tool extention for the open-sourced react extention library.

  1. It allows you to inspect the react component hierachies
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

For getting started with ReactJS we can choose between two methods:

A
  1. Import the library directly into an HTML file

  1. Start from create-react-app
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

You must not forget to link the boostrap.css inside either

A

./src/index.js

or

./src/App.js

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

The only method you must define in a React.Component subclass is called

A

render( )

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

In order to make your component usable and importable from other ones, you need to export it after its declaration. What is the syntax?

A

export default App

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

JSX accepts dynamic code inside what?

A

curly braces ({…})

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

Which React lifecycle method is the only required method when writing a class component, and is the most important one?

A

the render()

(it’s in charge of outputting your JSX and create DOM nodes into the page.

It will be re-invoked every time there’s a change in the props or in the state of your component)

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

Which is the first method invoked in a class component mounting process.

A

constructor( )

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

Which lifescycle method is a method which gets triggered after the component has fully mounted, or after its initial render took place?

A

componentDidMount( )

(It will just be triggered once during the entire lifecycle of a React component.)

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

Which method gets triggered every time an update occurs in the component, so every time a change in its state or in its props does happen?‌

A

componentDidUpdate( )

17
Q

Which method gets triggered just a moment before your component gets unmounted (removed) from the DOM?

A

componentWillUnmount()

(This is especially useful for clearing timeouts or event listeners that are not going to be used anymore.)