reactjs questions part 2

 1 How memoization works, and when/why it should be used


2 The virtual DOM. What it is, and how React uses it to update the actual DOM


3 How keys are used in lists, and why they should be stable and unique


4 Describing the lifecycle of a React component


5 How useEffect actually works, and when you do and don't need to use it


6 How hooks work, and why you would want to encapsulate business logic in a custom hook


7 I would also be prepared to discuss dependency arrays (specifically for hooks that will produce side effect such as useEffect and custom hooks that update some value) and why you need to be very discerning with what you include in these arrays


8 I mention specific hooks because generally speaking, hooks that return a function or a computed value (useCallback/useMemo) should use exhaustive dependencies, whereas hooks that update something without direct user interaction need to be tightly controlled




* how to pass data btwn siblings, know how to fetch data and render to a list, be able to show where u can implement useCallback to improve your app, and be able to work w forms/formData like you know the back of ur hand.




Building on what others have said:


1 make sure you can articulate what instigates a component re-render. You’ll wanna be able to talk to different patterns that cause and can prevent excessive re-renders ie. component composition, memo, use/misuse of contexts, adjusting where state lives


2 have a thought through opinion of state management. Know all the tools of where state can live. At what point would you choose to introduce a context or a state management library. When/why should a particular state live in one place vs another


3 understand how useEffect and useLayoutEffect fit into the component render lifecycle. Know why you would choose one over the other. The official react docs have very good explanations so make sure you’ve read through and groked


4 make sure you understand and can articulate refs vs state. When/why you use one over the other to hold data and how that plays into component lifecycle.



-----------------

It doesn't matter if you think you know the "fundamentals".


Can you demonstrate basic React knowledge and experience in 5 minutes.


Can you create a basic React app, components, props, state, etc. in 5 minutes? So that you can solve the tech interview assignment? While the interviewer is watching?

--------------

In my interview they asked me difference between pass by value and pass by reference, difference between class component and functional component, tools for debugging, how would i improve their legacy software step by step, dom, hydratation and memoization...

------------------

For a senior frontend position, I would ask almost no React questions. I would probe your understanding of the browser, cookies, security, DNS, the DOM, web components- and then system design questions relating to middle tier web architecture.. like URL shortener, or something similar with a piece on scaling.


Any position that asks really specific React domain questions isn’t actually looking for a senior dev.

-------x-----------


Q:If you have a parent component that has a useEffect, and it has a child component that also has a useEffect, in which order will the effects be executed ? In other words, which one will fire first, the one in the parent or the one in the child.

A:Child components’ effects fire first because React ensures that the child components are fully mounted and their effects have run before the parent’s effects execute. This makes sure that any effects that the parent relies on from its children are in place before the parent’s useEffect fires.

------------------


Comments

Popular posts from this blog

reactjs questions part 4

ReactJS: How and when to force a React component to re-render

Q: Error Boundary in React that catches an error and displays a fallback UI