DEV Community

Discussion on: How knowledgable you are about React? See common mistakes people make

Collapse
stereoplegic profile image
Mike Bybee • Edited on

For some reason, many developers think that all functional components are pure. That is not the case. Functional components used to be stateless, but now with hooks that's not the case either. So the main difference between functional components and class components is just the syntax, and that you can only use hooks inside functional components.

Blame the codebases they're working in, and often old versions of React/React curriculum they're learning in e.g. boot camp.

It's common to hear "don't worry about migrating your existing class components to functional with hooks any time soon, just consider FC/hooks for new component development." I disagree. After seeing the difference in transpiled output and getting a feel for the functional variants of lifecycle methods, I've even started looking to port third party dependencies to hooks.

Unfortunately, a lot of the companies they're coming from don't share my opinion.

Also, there are some things you can only do with class components, like defining ErrorBoundaries.

Technically true (c'mon Facebook, I don't ever want to see a class component again), but use-error-boundary is very handy for this (and I wouldn't fault a candidate for referring to it if Error Boundaries are brought up).

Collapse
adamklein profile image
adam klein Author

Thanks for the feedback :)
I agree many bootcamps don't go deep enough, or even mislead developers. I hope some of them read posts like this one and will improve the curriculum :)

Collapse
stereoplegic profile image
Mike Bybee • Edited on

I've had surprisingly good luck with boot camp grads, quite often better than grads from some of the best CS programs (it helps that they're not wasting a year or more learning Java if they're going to be FEDs, or loaded down with more work for core classes than major classes), but I largely attribute that to personal drive, "spend it like it's your own money" mentality (critical with bootstrapped startups), and higher likelihood to self teach (possibly due to the camps not going deep enough or, as I conversely hear sometimes, the way some of them make students "drink from a fire hose"). If the obsession over degrees weren't so awful when I was trying to break in (and it's still pretty terrible), and boot camps were as widespread as they are now, I might have opted for one instead of all the time and money I wasted on college.

With complete hindsight, though, I would have just saved the money all but completely and spent all that time self teaching, perfecting my portfolio and lighting up the crap out of my GitHub contribution graph (instead of being too busy outside of school building other people's proprietary stuff for way too little pay to work on my portfolio or FOSS, for which college gave me nothing of value to share). I'm trying to do my part to fight that mindset for newer devs:

LinkedIn Education and Certifications sections

Either way, I make "You Don't Know JS" required reading, and get them up to speed on FC, context, and hooks (the shock once it clicks and they realize they may not ever have to write another class component is priceless).