⏱ 0:00est. 5 min
Hcl
/**
What is the purpose of promises in JS
- Promises are used to handle asynchronous operations in JavaScript.
What is the purpose of asyn/await in JS
- It simply allows us to write promises based code as if it was synchronous and it checks that we are not breaking the execution thread
How to make page responsive
- A website is responsive if it is able to adapt to the screen of the client.
- @media screen and (max-width: 1060px) { } OR @media screen and (max-width: 768px) { }
React hooks interview questions
https://www.fullstack.cafe/blog/react-js-interview-questions
How to set state in react with hooks
useEffect(() => {
})
useCallback and useMemo
useCallback - Returns a memoized callback. Pass an inline callback and an array of dependencies. useCallback will return a memoized version of the callback that only changes if one of the dependencies has changed. This is useful when passing callbacks to optimized child components that rely on reference equality to prevent unnecessary renders (e.g. shouldComponentUpdate).
useMemo - It is a React hook that is used for caching CPU-Expensive functions. Sometimes in a React app, a CPU-Expensive function gets called repeatedly due to re-renders of a component, which can lead to slow rendering.
useMemo( ) hook can be used to cache such functions. By using useMemo( ), the CPU-Expensive function gets called only when it is needed.
How to increase performance of app
- How to do code splitting
- Event loop
closure
Let and var
Map objects and javascript objects
- The Map object holds key-value pairs and remembers the original insertion order of the keys. Any value
const map1 = new Map();
map1.set('a', 1);
map1.set('b', 2);
map1.set('c', 3);
console.log(map1.get('a')); // expected output: 1
map1.set('a', 97);
console.log(map1.get('a'));
// expected output: 97
console.log(map1.size);
// expected output: 3
map1.delete('b');
console.log(map1.size);
// expected output: 2
What's redux
How to access data from redux
How to focus input in react
<input
ref={(input) => { this.nameInput = input; }}
defaultValue="will focus"
/>
this.nameInput.focus();
**/