React Part 4 Flashcards

1
Q

Controlled components

A

A component that controls the input elements within the forms on subsequent user input

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

Uncontrolled components

A

The one that store their own state internally, query dom to find its ref

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

What is Lifting State Up in React?

A

When several components need to share the same changing data then it is recommended to lift the shared state up to their closest common ancestor

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

Different phases of lifecycles ?

A

Mounting: The component is ready to mount in the browser DOM
Updating: In this phase, the component gets updated in two ways, sending the new props and updating the state
Unmounting: In this last phase, the component is not needed and gets unmounted from the browser DOM.

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

componentWillReceiveProps

A

Executed when particular prop updates to trigger state transitions.

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

shouldComponentUpdate:

A

Determines if the component will be updated or not. (default: true, set to false to prevent a re-render when component receives new prop)

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

ComponentWillUpdate

A

execute before re-rendering components when state/props changes comfirmed by shouldComponentUpdate return true

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

componentDidUpdate

A

Mostly it is used to update the DOM in response to prop or state changes.

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

getDerivedStateFromProps

A

Invoked right before calling render() and is invoked on every render (rarely use)

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

Higher Order Components

A

A higher-order component (HOC) is a function that takes a component and returns a new component.

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

Stateless Component

A

If the behaviour is independent of its state then it can be a stateless component

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

What are stateful components?

A

If the behaviour of a component is dependent on the state of the component then it can be termed as stateful component.

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

React Composition

A

development pattern built based on React’ original component model where we build components from other components using explicit defined prop or implicit children prop.

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

Why use React Composition ?

A

This technique prevents us from building too many similar components containing duplicate code and allows us to build fewer components that can be reused anywhere within our application,

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

Specialized Components

A

A specialized component is a component that is built from its accepted props to handle one specific case.

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

Container Components

A

A container component, also known as a parent component, is a component that provides the state and behavior to its children components.