React Flashcards

1
Q

[React Elements]

What is React?

A

A JavaScript library / framework for building user interfaces

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

[React Elements]

What is a React element?

A

a plain JS object with a list of properties describing what an actual HTML element should have

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

[React Elements]

How do you mount a React element to the DOM?

A

calling the render method of the root object and passing a real DOM element as an argument

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

What is the difference between library and a framework?

A

Library - code already made by someone else

Framework - have IoC (inversion of control)

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

[Babel Intro]

What is Babel?

A

A JavaScript compiler

Converts ECMAScript 2015+ code into backwards compatible version of JS

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

[Babel Intro]

What is a Plug-in?

A

a software add-on that enhances the software

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

[Babel Intro]

What is a Webpack loader?

A

preprocesses the code, creates a main.js that is ready to run in the browser

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

[Babel Intro]

How can you make Babel and Webpack work together?

A

babel loader

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

[React JSX]

What is JSX?

A

A syntax extension to JavaScript

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

[React JSX]

Why must the React object be imported when authoring JSX in a module?

A

because JSX produces React elements

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

[React JSX]

How can you make Webpack and Babel work together to convert JSX into valid JavaScript?

A

with webpack, babel and babel loader, and jsx plug-in

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

[React Function Components]

What is a React component?

A

JavaScript functions or class that take props and returns React elements

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

[React Function Components]

How do you define a function component in React?

A
function ComponentName (props) {
           return (
                      < Text Content { destructure: prop.property } / >
           )
};
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

[React Function Components]

How do you mount a component in the DOM?

A

create a react element through the component and add it to the root

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

[React Props & Expressions]

What are props in React?

A

arbitrary inputs

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

[React Props & Expressions]

How do you pass props to a component?

A

pass it in the component function argument

17
Q

[React Props & Expressions]

How do you write JavaScript expressions in JSX?

A

using { }

18
Q

[React Class Components]

How do you create ‘class’ component in React?

A
class CustomEle extends React.Component {
       render() {
            return ( React element )
       }
}
19
Q
[React Class Component]
How do you access props in a class component?
A

this.props.propName

20
Q

[React Events and State]

What is the purpose of state in React?

A

a data model of things that will change over time in a React element

21
Q

[React Events and State]

How do you pass an event handler to a React element?

A

create the handler method
bind the handler to the props
< element event={this.handler} /

22
Q

[React form controls]

What are controlled components?

A

Components that have limitations but take in inputs from users

23
Q

[React Form Controls]

What two props must you pass to an input for it to be ‘controlled’?

A

onChange

value prop

24
Q

[React Rendering Lists]

What ‘array’ method is commonly used to create a list of React elements?

A

.map()

25
Q

[React Rendering Lists]

What is the best value to use as a ‘key’ prop when rendering lists?

A

unique string IDs

26
Q

[Fetch in React]

When does React call a component’s ‘componentDidMount’ method?

A

after a component is mounted and rendered successfully (inserted in the DOM tree)

27
Q

[Fetch in React]

Name three React.Component lifecycle methods.

A

constructor()
render()
componentDidMount()

28
Q

[Fetch in React]

How do you pass data to a child component?

A

pass that into a child component’s props