React Native Flashcards

1
Q

components

A

small, isolated code blocks to determine render. When data changes, React updates+re-renders.

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

React component class/type, parameters/properties(props),

A

a component which accepts props and returns a view hierarchy, displayed via its render().

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

render()

A

description of what to see on screen; React takes, then displays result

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q
equivalent of JSX below in JS:
<div>
  <h1>Shopping List for {props.name}</h1>
  <ul>
    <li>Instagram</li>
    <li>WhatsApp</li>
    <li>Oculus</li>
  </ul>
</div>;
A

React.createElement(“div”, {
className: “shopping-list”
}, React.createElement(“h1”, null, “Shopping List for “, props.name), React.createElement(“ul”, null, React.createElement(“li”, null, “Instagram”), React.createElement(“li”, null, “WhatsApp”), React.createElement(“li”, null, “Oculus”)));

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

how to respond to click in button?

A

pass in function for onClick prop.

    {this.props.value}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

=>

A

“arrow function”; lambdas

(param1, param2) => block; returnValue

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

super

A

whenever defining constructor of subclass, call super(props)

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

if you change state in component’s render(), …

A

React will re-render when state changes

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

to change state, use

A

this.setState({comment: 'Hello World!'});
not
`this.state.comment = ‘Hello World!’

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

state where?

A

lift state up

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

state privacy

A

state is private to component which defined it

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

controlled components

A

components where the render’s properties are fully set by props

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

function components

A

for components that only render, replace render() with function

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

ternary JS

A

var = ? “isTrue” : “isFalse”;

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

mental model:

A

we build from components.
components take in props
components with state, initialize state, and change state thru functions.
state is private to a component, but can pass state to child components.
children can’t change parent’s state, but can be given handlers by parents, which they call, which leads a parent to affect that parent’s state.
render() in a component returns components that make up that component
can replace render with function that returns same as render
=> is lambda, where (params) => return+exec_block

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

keys

A

specify list items