What will be the output of the following code? ```javascript console.log(1); setTimeout(() => { console.log(2); }, 0); Promise.resolve().then(() => { console.log(3); }); console.log(4); setTimeout(() => { Promise.resolve().then(() => { console.log(5); }); }, 0); ```
Frontend
What is useEffectEvent and why is it needed?
import { useState, useCallback } from 'react' const Component = () => { const [count, setCount] = useState(0); const handleClick = useCallback(() => { console.log(count); }, []); return ( <div> <div onClick={() => setCount((prev) => prev + 1)}>Count: {count}</div> <div onClick={handleClick}>Log</div> </div> ); };
What state managers were used? What is bad about Redux?
Why is the key attribute needed in React lists?
Tell us about the development process and Git-flow in your team. How is the code review process organized?
What are generics in TypeScript and why are they needed?
How to fix the stale closure problem in useCallback without adding dependencies to the dependency array?
Tell us about yourself and your most recent work experience.
What happens when a URL is entered into a browser? Describe the process from DNS query to page rendering.
What builders did you use, did you write your own configs?
What is a closure in JavaScript? Provide an example.
How would you approach solving performance issues in a React application if a user complains about lag?
import { useEffect, useLayoutEffect } from 'react'; export default function App() { console.log('1'); useEffect(() => { console.log('2'); }, []); useLayoutEffect(() => { console.log('3'); }, []); return <div>BCraft</div>; }
export const usePhoneMask = ({ mask, initialValue, maskPlaceholder, }: UsePhoneMaskParams): UsePhoneMaskReturn => { // code here };
import { useState, useEffect } from 'react'; export default function App() { console.log('1'); useEffect(() => { console.log('2'); }, []); return <Child />; } function Child() { console.log('3'); useEffect(() => { console.log('4'); }, []); return <div>Bcraft</div>; }
What is the Event Loop in JavaScript? In what order are tasks executed?
How to handle a situation where props have been updated, but the previous request has not yet finished? How to avoid race conditions?