React Flashcards

1
Q

React is used to…

A

create components, handle state and props, utilize event listeners and certain life cycle methods to update data as it changes

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

react combines

A

HTML with JS functionality to create its own markup JSX

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

nested JSX must return ____ element

A

a single

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

several JSX elements written as siblings with no parent wrapper element _____ transpile

A

will not transpile

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

commenting JSX

A

{/* */}

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

how to render React elements to the DOM

A

ReactDOM.render(componentToRender, targetNode)

ReactDOM.render(, document.getElementById(“challenge-node”));

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

define HTML classes in JSX

A

className instead of class

everything changes to camel case as well

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

rules around closing tags

A

any can be written with a self-closing tag & every element must be closed

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

everything in React is a

A

component

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

a stateless component is

A

one that can receive and render data, but doesn’t make or track changes to it

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

React requires your function name to begin with

A

a capital letter

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

syntax to create a stateless component

A
const name = function() {
return (
);
};
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

two ways to define React components

A
  1. function

2. class

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

create a component by extending React.Component

A
class Kitten extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    return (
      <h1>Hi</h1>
    );
  }
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

create component with composition

A

create parent component and write it as a tag in the return part of render()

return (

)

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

for prop values to be evaluated as JS, they must be

A

enclosed in curly brackets, for instance, date={Date()}

17
Q

A stateless functional component is

A

any function you write which accepts props and returns JSX

18
Q

A stateless component is

A

a class that extends React.Component, but does not use internal state

19
Q

a stateful component is

A

a class component that maintains its own internal state. stateful components = simply components or React components

20
Q

A common pattern is to try to

A

minimize statefulness and to create stateless functional components wherever possible