I started with React when function components were already widely established, so I never got to work much with class components and therefore don't know a lot about them. I would say the general feeling in the industry is also that class components are somewhat deprecated in favor of function components, and new projects are almost guaranteed to use those.
A company I'm interviewing at is putting me through a live coding "challenge". For the challenge, they present me with a dummy chat app codebase which consists entirely of class components, along with some WebSocket connection/disconnection logic in onComponentDismount
etc. They then ask about what specific parts of the code do, and also ask to find and fix some bugs that they sprinkled around the code.
The difference between class and function components aren't huge, but the whole lifecycle (onComponent*
vs. useEffect
) and also how the state works (setState
vs useState
) have some subtle differences, and getting them wrong in an interview on accident if you're not very familiar with them can give off a bad impression. Also, extracting shared business logic into a hook is impossible with class components and I have no idea what the class component alternative would be.
I'm guessing since the company's developers deemed it acceptable to ask questions about class components, that their codebase is heavily invested into class components as well, therefore it is understandable that they are interested in testing the interviewee's class component knowledge. On the other hand, it doesn't do much justice to my otherwise quite good React knowledge if they only ask about a component style that I've never worked with, and frankly, is sort of obsolete in 2022.
Of course, I could sit down a couple of evenings and learn class components, but putting all of that work just for a coding challenge, passing which does not guarantee that I will get the job, seems like a disproportionate amount of effort, also considering that if I don't get the job, this knowledge is very unlikely to benefit me in other companies and projects, especially as the years go by.
I've mentioned my feelings to the HR guy, who obviously didn't understand much of it and told me to write down a couple of sentences that he would forward to the developers preparing the challenge for me. How would I suggest to the developers to focus on function components in the challenge instead in a polite way, without making it seem that I'm unfit for the position?