Front End Flashcards
(93 cards)
What are synthetic events
Synthetic events combine the response of different browser’s native events into one API, ensuring that the events are consistent across different browsers.
React features
Jsx
Community
High performance
Virtual dom
One way data binding
What is virtual dom
React keeps a lightweight representation of the real DOM in the memory, and that is known as the virtual DOM. When the state of an object changes, the virtual DOM changes only that object in the real DOM
Difference ES5 and ES6
Imports
What is an event
action that a user or system may trigger, such as pressing a key, a mouse click, etc.
Why are keys necessary for lists
To find components on virtual dom and only replace them
Arrow functions difference to normal functions
It is unnecessary to bind ‘this’ inside the constructor when using an arrow function. This prevents bugs caused by the use of ‘this’ in React callbacks.
what are data structures
how to save and organize data
files structure vs data structure
files are save on disk, data on RAM or disk. File has low compatibility with other applications
what are linked lists
structure that has nodes that are connected to each other forming a chain
ways of searching in structures
lineal: iterating through it
binary: separate into chunks, then perform a search
what are hooks
specific react functions that allow you to use things like state, lifecycle events etc. in functional components
limitations of react
high learning curve
low structure and much freedom make projects look different
what is dangerouslySetInnerHTML
allows to dangerously add html that is not checked by React and may allow injection of malicious code
React lazy
allow the use of components that don’t end up in the bundle. They are fetched when they want to be used and a fallback is shown. Lodable library adds suspense to it to make it easier to use
How to optimize performance
React.lazy
React.memo
Fragments instead of divs
State and form libraries to improve rerendes
What is reconciliation
react updates dom when value changes
what are higher-order component (HOC)
Injects reusable logic in a component like styling, props, loading behavior etc.
What is a closure?
Closure is a function in a function. The inner function has access to the outer’s function scope and parameters even after the outer function has returned.
What are the differences between call, apply, and bind?
call and apply immediately calls a function while bind creates a new function that can be invoked in the future. Arguments with call are passed in one by one, separated with a comma while apply expects an array as its argument.
What is currying function
separating a function with many arguments into many function with one argument to make code more readable
What is memoization?
Memoization is an optimization technique by storing the result of expensive function calls and returning the cached results when the same inputs occur again.
What is a higher-order function?
a higher-order function is a function that accepts another function as an argument or returns a function as a return value or both of them.
Map, filter and reduce are some examples of higher-order functions that are already built-in to JavaScript.
what is css box model
The box model is a box that wraps around every HTML element.
The box contains content, padding, border, and margin.