Frontend development tips Flashcards

1
Q

Why onSuccess/onError removed from useQuery

A
  • An additional render cycle
  • The callbacks might not run (cache)

soultion: onDataChanged in effect

https://tkdodo.eu/blog/breaking-react-querys-api-on-purpose#state-syncing

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

How can slow down the browser speed?

A

Chrome DevTools > Performance Tab
CPU = 4 *slow down or …

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

Which size metric is most relevant when considering the impact of a JavaScript library on a project?

A

The minified and gzipped size is the most relevant metric as it reflects the compressed size of the JavaScript code for efficient network transfer and optimal page loading.

https://bundlephobia.com/

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

what’s the categories for a system design in frontend side

A
  • features
  • non-functional requirements
  • user experience
  • engineering
  • back in API
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what things are considered in features category FE sys Design

A
  • MVP
  • high-level estimation
  • core functionality

High level estimation
data volume , Peak traffic

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

what items are included in non-functional requirements in front end system design

A
  • performance
  • offline mode
  • security
  • high availability

performance
* Cache
* CDN
* load on demand or preload
* page spliting

offline mode
* local storage
* indexedDB

security
* xss
* csrf

high availability
* load balancer
* health check

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

Explain how JavaScript handled multiple files before the introduction of modules. What were the downsides of this approach?

A

multiple files could be included in a web page using multiple

 tags in HTML

all scripts loaded onto the same page shared the same global scope. This meant that scripts had to be careful not to overwrite each other’s variables and functions, leading to potential conflicts and bugs

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

Describe the role of the “host” in the context of TypeScript module resolution and provide examples of different hosts.

A

the “host” is the system that ultimately consumes the output JavaScript code and directs its module loading behavior.

The TypeScript compiler models the behavior of the host to ensure correct module resolution and type checking

.Examples of different hosts:
Node.js Runtime
Bundlers
Web Browser

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

Webpack?

A

Webpack is a popular module bundler
- it compiles files into static assets that browsers can easily serve
- It handles bundling, transpiling, and optimizing assets js/css/img

performance optimization:
- code splitting, tree shaking, minification

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

what’s tree shaking?

A

-elimiate not used imports , varaibles, functions (* as lodash)
- less as possible

  • in v5 - comes by default
  • it only works with es6 static imports (not dynamic)
  • not works with common js (require) it’s dynamic
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

css in js , cons, pros

A

like styled-components

    • scoped styles
    • dynamic styling
    • performance runtime overhead,
    • learning curve
    • you can not cache the css files
    • makes bundle bigger
    • harder to debugg
  • webpack, extract those classes and attaches in html dom in runtime
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly