3 ms·
I have a similar problem. I find react to be needlessly verbose; half way through a moderately-sized PR and I realise I have no idea what I'm looking at, becaus
by undecisive 6y ago
I have a similar problem. I find react to be needlessly verbose; half way through a moderately-sized PR and I realise I have no idea what I'm looking at, because I wasn't paying enough attention to the context.
Different companies have different things they focus on in PRs. If you're looking at the shape of the code, then that will probably jump out at you (is this file massive? Does there appear to be lots of heavy nesting? Are the functions short and snappy?) In that case, you'll probably find that despite being disengaged from the code, anything terrible is going to jump out at you.
In others, you're expected to be a wetware parsing machine, finding bugs or unintended functionality. In that case, if you don't "get" the flow then you're never going to be as thorough as with python. In that case, you're essentially doing someone else's job, and at some point you have to decide to either make it your job (i.e. devote yourself to only writing react components for a month, become fluent so that you can grok it effectively) or pass it on to someone better equipped for the job. That is in no way cheating or shirking - that's effective management and delegation. Use the strengths of your team. If that's not a possibility, e.g. your team is too small, then the first option is your only choice.
Another thing to point out is that the architectural patterns you are used to very much influence the way you view the code. React's architectural patterns are far more messy than python's, in that you need to keep several threads in your mind at once (where does this state come from? Props? Params? Redux? Events? Events stored in redux?) and can be a bit mind bending given the very limited window you see from a PR.
So that's my general advice. I'd say, cut yourself some slack. If you need help focussing, from tiredness or fatigue, keep a notepad handy and write down each filename, and count the number of methods and if statements in the file. That will force you to at least look at every line twice - once potentially without paying enough attention, second to do your counting.
Now for the specific advice: If you are outsourcing your work to a team of developers who you can't trust to PR between themselves and are experienced in the tech stack that is not one you get, then either:
a) You shouldn't be using that tech stack. There is nothing that can be achieved in React that can't be done in more traditional JS frameworks. New technology should only be introduced by teams that you trust implicity to get it right between themselves. React is the problem here.
b) You shouldn't be using those developers. I know, they're cheaper, but are they? Really? In the long run? They are the problem here.
c) You need support within your organisation. Doesn't need to be another lead developer, could be a competent middleweight who knows your standards and can apply them consistently. Your isolation is the problem here.
There are probably more advices I could give, though maybe that's more advice than you wanted. Good luck!