re: React coding challenges for interviews/beginners VIEW POST

re: in the dark theme exercise, how should the interviewee answer ? I've always been told that it's not best practice to alter the root html tag, so I ...

Howdy! Excellent point. Directly modifying is frowned upon and in fact, directly modifying the DOM in general is considered bad practice. In saying so, I've definitely had times in my career when I've been forced to alter the class list of a top level element directly, for example, when setting a global cursor during a drag. I would say changing classnames is low impact. I might tweak this task/scss and suggest it to be applied at a lower container level (ie. render a div in the app container instead), which would probably be more representative of a real application. Not a bad idea to know how to manipulate the DOM anyway.

These tasks are not so much designed to be 'answered'. It's an opportunity for an interviewer to assess a candidates skills and their communication. I would expect my candidates to be thinking through the problem and talking through their solution.

As long as the candidate demonstrated knowledge of the problem and solution and could justify what they're doing, I wouldn't be as bothered about their final technical solution. For example, if you could justify what you just posted in relation to the HTML tag and made a decision to apply the class lower down (not at the component level) then I'd give that a tick.

Hope this answers your question!


Great answer, thank you 😀
The whole idea is really interesting, and I like the idea of watching the candidate evolving through a codebase, and communicating throughout the exercise. I might try and use that kind of test for my upcoming interviews !

code of conduct - report abuse