Questions & Research for Senior React
Status: #seedling
This is a list of things I've collected from various sites relate to interview questions for React senior devs + other relevant resources. I plan to
- How memoization works, and when/why it should be used
- The virtual DOM. What it is, and how React uses it to update the actual DOM
- How keys are used in lists, and why they should be stable and unique
- Describing the lifecycle of a React component
- How
useEffect
actually works, and when you do and don't need to use it - How hooks work, and why you would want to encapsulate business logic in a custom hook
- 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- 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
- I mention specific hooks because generally speaking, hooks that return a function or a computed value (
SSR
advanced hooks
I’ve been asked about event lifecycles and was completely stumped and had been working with react for over 4 years at that point.
So, to answer the question: during interviews, I usually prefer to ask more general questions about architecture rather than questions about specific APIs (like useEffect and such).
I like to include refactoring questions - showing devs pieces of code and asking about code smells and their approach to refactoring.
- Create a component that displays a recursive nested folder structure, displaying any files in the folder, and any subfolders. When a folder is clicked, display it's contents.
- Create a slider component with only javscript. No css or html. Create all elements and attributes with javascript in a single file.
- Create a pagination component that fetches a list and displays X items at a time. It should have buttons to show the first and last pages, as well as buttons to move to the previous and next page.
- Create a debounce function on an input field that displays a list of filtered items matching the input, updating on an interval passed into the debounce function.
- Create a promise that resolves a list of data to simulate an API call, and a component that displays its data.
- Create an event emitter class that can add an object to a list, retrieve the entire list, and remove items from the list.
https://www.youtube.com/playlist?list=PL6dw1BPCcLC4n-4o-t1kQZH0NJeZtpmGp
https://bigfrontend.dev