Week of July 16 2018 Flashcards

1
Q

REACT:

What’s he name of the npm package for React Router

A

react-router-dom

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

REACT ROUTER:

What to import from React Router to create basic routes.

A

BrowserRouter, Route

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

REACT:

Conditional rendering inline. How to check if an array is empty?

A

array. length > 0 && ….(render component)

array. length alone will not work as this value has to be a true boolean (not just truthy or falsy)

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

REACT:

When to use parentheses in React components returning JSX?

A
  • Parentheses are needed when explicitly returning multiple lines of code (in general in JS) , i.e. when using the ‘return’ keyword.
  • Parentheses are not needed when implicitly (no return keyword) returning JSX in arrow functions (even multiple lines).
  • Some (including Prettify) consider wrapping multiple lines of JSX in parentheses - even in the latter case - best practice.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

JAVASCRIPT:
Explain ‘const’
(5 bullets)

A
  • used to declare a constant
  • values can only be assigned at time of declaration
  • constants cannot be redeclared
  • constants in JS are block scoped
  • ES 2015 syntax
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

JAVASCRIPT:

What does immutable mean in Javascript?

A
  • Immutable data types cannot be changed after they were created.
  • JS primitive data types are immutable: strings, numbers, booleans, null, undefined, symbol (new in ECMAScript 2015).
  • Changing a value will create a new value.

https://benmccormick.org/2016/06/04/what-are-mutable-and-immutable-data-structures-2/

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

JAVASCRIPT:

What does mutable mean in Javascript?

A
  • Mutable data types are objects (including ES 2015 sets and maps).
  • Changing a value will change the value in all references.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

JAVASCRIPT:

What’s a ES 2015 alternative for a for loop?

A

for…of:

creates a loop iterating over iterable objects (arrays, strings, etc.)

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

REACT - Forms:

What’s the difference between HTML and JSX in “” elements of the type text?

A

None.

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

REACT - Forms:

What’s the difference between HTML and JSX in elements?

A

HTML:
- text content goes in between tags.
Content goes here

JSX: text content is assigned in value prop (similarly to text input)

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

REACT - Forms:

What’s the difference between HTML and JSX in dropdown elements and ?

A

Only difference is the by default selected option:

HTML (select by adding a select prop (no value)

One
Two
Three

JSX (select by setting select element’s value)

One
Two
Three

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

REACT:
Way to satisfy React’s (or React Router’s) requirement to return a single parent element without adding another div to the DOM?

A

Wrap with

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

INTERVIEWS:

What do interviewers likely want to learn when they ask you about projects?

A

Besides that they want you to be an active coder they want to see that you can articulate and describe technical issues. So go into implementation details!

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

REACT:

How to direct with React Router?

A

Use withRouter function supplied by react-router-dom and return the component from the function (wrap it) which gives you the history.push method.

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