Understanding the React Source Code, Part 1
hackernoon.com
hackernoon.com
Note that this is based on React 15.6.2, an older version of React. In React 16 we rewrote almost the entire codebase so that one may be more interesting to look at, depending on your goals. I guess – just don't blame us for some of the strange code patterns in 15 (like that random TopLevelWrapper) that we've since gotten rid of. :)
You need a fix for problem "x". You can either write the ugly hack by next weekend knowing that it's going to be replaced by the big rewrite you have coming up in 6 months, or you can spend 1 month refactoring code to make a "proper fix" that will last another 5 months until the code is rewritten...
Of course when you have an audience, they get to read into this however they feel. Some will point to the hack as an example of how awful the codebase is and how bad the developers are, others will point to it and proclaim (wrongly) how dirty hacks are never a bad thing if they work, still others will talk about how much better their idea their idea would have been even though it didn't fit your exact constraints.
In my experience, very very few successful developers are "dumb" or "bad at programming" or whatever insults you see thrown around all the time. Most of the time it's just someone making the best of a shitty situation weighing several constraints while still keeping the product working.
People who don’t at least try to write better code every chance they get have a pretty poor understanding of “best” in a given situation. They will grow very slowly if at all, and their best isn’t good enough. And if it turns out you were the negligent party, don’t you want to know that? Don’t you want to recollect how you rationalized that piece of work and adjust your behaviors?
Above all else, don’t count on a rewrite. It is a Once in a Blue Moon affair and if often goes wrong. It’s the worst kind of crap shoot. The worse things are the less likely the rewrite will work. Rewrites require you to recall the entire featureset and if the project is off the rails then nobody knows all of them, so any part you touch is likely to miss something important.
Edit: the rest of a thought
!
Rewrote‽
http://www.mattgreer.org/articles/react-internals-part-one-b...
Thank you for React! The other day I was tired of working and decided to engage in some “recreation” by upgrading 15.4->16.2. It was really smooth. Warnings introduced in 15.6 made it even easier. Ran some code mods, updated some dependencies. Done. The new excellent error handling jumps out at you right and away.
Does he mean transpiling time? Honest question, don't have any experience with web frameworks.
Shouldn't it be more important for senior team members be able to provide difficult feedback with grace?
I have an issue with these kind of memes that are similar to the "it doesn't hurt to know Lisp or Haskell"....whatever.
It might hurt your goals. There's an opportunity cost involved. So you're either learning a new language or digging into the source code of React at the expense of something else.
It's not a zero-sum game, but closer to zero-sum then what these memes would have you believe.
I would say that reading a comment that could almost be construed as dissuading learning might hurt someone's goals to a more significant degree than typing "it never hurts" very very slightly erroneously.
e.g. replace consumption of something like media (netflix?) for learning more about React internals
Now if the author had said, "It never hurts to give up everything else you are doing and look at this codebase for 1 year and shirk all other responsibilities" I'd agree with you, but otherwise you're just being pedantic for the sake of it.
I think anyone who works with React or React native should have a rough idea of what’s going on under the hood.
The above article series seems to do a decent job of this for a framework people use day in and day out.