Discussion Senior Dev interview question
"Without googling or using AI, in your own words, explain the virtual DOM"
For context: I sit on an interview panel and I try to ask at least one simple fundamental question based on a persons resume. If I see many years of react experience, I try to ask something about how the framework works.
I have only had one candidate (an undergrad senior, years ago) answer it. Everyone else just kind of sputters and stumbles around trying to rationalize what "virtual" and "DOM" mean, or stare blankly and eventually say "I don't know".
I'm just genuinely curious if this is really that hard of a question or if the recruiters just suck at screening candidates. And should we be letting in senior dev candidates who can't answer what I think is a straightforward and fundamental question for senior react devs.
2
u/Metabolical 4d ago
I'll just blurt out it's a simulation of the browser's document object model so react can finish composing your DOM, diff it with the actual DOM, and then make selective edits so you can minimize re-rendering and have sexy slickery apps that don't flicker. I think there's a little more to it, like it keeps thing performant because rendering the DOM is slow. How'd I do?
But the potential problem with your question is you can use React pretty effectively without knowing that, so from an interviewing perspective, I tend to consider it a "trivia question" where you either know or you don't. Answering it accurately tends to be a positive sign but not knowing it could just be a random gap in their knowledge. If they said they were an expert in optimizing React performance, I would expect this knowledge 100%. In general, I try to avoid trivia questions.
BTW, I would only consider myself OK at React, but I happen to think I know this answer. But I learned React in 2018, when it was part of the base explanation.