Reactjs Flashcards

1
Q

What is this tag syntax called?

const element = <h1>Hello, world!</h1>;

A

JSX

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

React separates concerns with loosely coupled units called “components” that contain both.

A

Components

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

React DOM uses which naming convention?

A

Since JSX is closer to JavaScript than to HTML, React DOM uses camelCase property naming convention instead of HTML attribute names.

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

TRUE OR FALSE: By default, React DOM escapes any values embedded in JSX before rendering them.

A

By default, React DOM escapes any values embedded in JSX before rendering them. Thus it ensures that you can never inject anything that’s not explicitly written in your application. Everything is converted to a string before being rendered. This helps prevent XSS (cross-site-scripting) attacks.

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

What is an element?

A

Elements are the smallest building blocks of React apps.

An element describes what you want to see on the screen

Elements are what components are “made of”,

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

<div></div>

Why do we call this a “root” DOM node?

A

We call this a “root” DOM node because everything inside it will be managed by React DOM.

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

Conceptually, components are like ____________.

A

Conceptually, components are like JavaScript functions. They accept arbitrary inputs (called “props”) and return React elements describing what should appear on the screen.

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

Always start component names with a capital letter.

A

True

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

All React components must act like pure functions with respect to their props.

A

True

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

What are three things you should know about setState()?

A
  1. Do Not Modify State Directly
    For example, this will not re-render a component:

// Wrong
this.state.comment = ‘Hello’;

  1. State Updates May Be Asynchronous
  2. State Updates are Merged
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Why do we need to ‘import React from “react”’ in our files?

A

Because the JSX syntax in defined in React

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

If I were to console.log(page) in index.js, what would show up?

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