DEV Community

Discussion on: React Interview Questions 🔥

 
sobingt profile image
Sobin George Thomas

@lukeshiru True. React Hooks are a complete and better replacement for Classes. But that doesn't mean we have to rewrite tens of thousands of components written as classes. Instead, we use Hooks in the new code side by side with classes. Also, I don't think React has any plan to deprecate classes. Also long as there is legacy code support, someone has to maintain them. The best example is COBOL and FORTRAN, they refuse to die. Some poor developer is surviving on them.

Source

Thread Thread
 
jwhenry3 profile image
Justin Henry

The Legacy Code Problem is one that ultimately needs to be addressed first. Any decent Software company will take it seriously and move away from as much legacy code as possible. If you don't, you risk dependency vulnerabilities, version incompatibilities, performance bottle-necking, and increased maintenance cost just from it sitting stale for long periods of time without eyes on it. I can't tell you how many times I've been told "we have to do it this way because of legacy code" and that is not a sufficient answer to any problem. You're supposed to keep your code up to date and as clean as possible as you grow as a developer, otherwise you will end up resenting the legacy code and lose willpower to touch it.

Some comments have been hidden by the post's author - find out more