basic Flashcards

1
Q

how do you call a component called person with parameters name and age?

A

ReactDOM.render(‘’,

document.querySelector(‘#p1’));

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

como se declara la funcion Person?

A
function Person(props) {
          return (
               <div>
                        <h1>{props.name}</h1>
                        Age : {props.age}
               </div>
      ); 
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is the major React component that you render through ReactDOM.render() method?

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

how do you import the react module

A

import React from ‘react’;

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

functional component definition?

A
declare through a function and also called stateless, dumb or presentational. 
const cmp = () => { return <div>some JSX</div> }
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

class-base component definition?

A
define through a class. stateful, smart and containers.
class Cmp extends Component {
        render() {
               return <div> some JSX </div>; 
        }
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

create a functional component that takes name and age as arguments?

A

import React from ‘react’;

const person = (props) => {
    return <p>I'm {props.name} and I am {props.age} years old!</p>;
};

export default person;

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

create a functional component that works like this:

Reading

A
const person = (props) => {
    return  <div>
                <p>I'm {props.name} and I am {props.age} years old!</p>
                <p>And my hobby is {props.children}</p>
            </div>               
};

export default person;

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

create a functional component that works like this:

Reading with the parentesis

A
const person = (props) => {
    return  (
                <div> 
                    <p>I'm {props.name} and I am {props.age} years old!</p>
                    <p>And my hobby is {props.children}</p>
                </div> 
            )              
};

export default person;

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

add an array of persons to the state property of the App class

A
class App extends Component {
  state = {
    persons: [ {name : 'Max', age: 28},
               {name : 'Manu', age: 29}, 
               {name : 'Stephanie', age: 26}
]   }    ...
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

props triggers an UI update? and state?

A

yes. yes too

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

where do you declare the state?

A

as a property in a class, specially App class

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

what is this inside to a non ES6 function referring to ?

A

not to the class but to something internal I am not sure. but if you use arrow functions it will always refer to the class.

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

in a class definition do you separate method declarations and poperties with ;?

A

no.

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

basic instruction for rendering a JSX element

A

ReactDOM.render(<h1>Hello world</h1>, document.getElementById(‘app’)); there’s a

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

two most important import fro react

A

import React from ‘react’;

import ReactDOM from ‘react-dom’;

17
Q

what is the container for a ReactDOM.render() expression?

A

the element where the expression is going to be rendered. in this case

18
Q

what is the virtual DOM?

A

it is a copy of the DOM created by React. when you do a render, the virtual DOM get’s updated then the diffing happens, i.e., React compares virtual DOM and last DOM snapshot, get the change set, and update the DOM on only the changes