4 ms·
I hesitate to admit this, but for me it's simply because I still don't know the right pattern to use. I'm a longtime backend developer that knows several useful
by tunesmith 2y ago
I hesitate to admit this, but for me it's simply because I still don't know the right pattern to use. I'm a longtime backend developer that knows several useful and usable patterns on how to organize layers of code into files and functions and conventions, that work very well. I've spent quite an amount of time on the frontend, to the point where I feel like I should have been able to identify a decent pattern by now, and I just haven't. And it's to the point that I started doubting whether the problem was really me, or if it's a problem with the framework. I've read the revised React 18 docs backwards and forwards, and all the stuff about how you might not need useEffect, and I've read countless articles about outer components and inner components and view components and higher order components, and when to use context and when not to, and there's a point at which all the patterns start to collide and feel self-contradictory. Meanwhile my team has a massive snarl of very large react components with all kinds of awful practices like nested contexts and useEffect for state management, stuff I tried to counsel against for a while until I got promoted away from the team... I just couldn't find the best practice that the community actually agrees upon regarding how to refactor and design a complex website with many components with deep functionality.
- gejose 2y agoI actually agree with this being / having been a problem. I think the root cause of this is react not really being a framework, rather just a library that allows you to write declarative code involving state that in the end, outputs a DOM tree. IMO it does that quite well. It doesn't have very many opinions on how you should structure your code, how you should organize your state, how your routing logic should work etc. I think that's where frameworks come in. React was quite popular long before frameworks like nextjs, meteor, remix, ... became 'mainstream', causing lots of developers to invent their own (poorly maintained) frameworks.
- h14h 2y agoI feel this. I think it's a consequence of react being a fairly unopinionated collection of tools. Coming from a Rails background, it's pretty jarring. It's like the difference between being told, "Here's how you build a house" and "Here's how you use the tools in this toolkit". React offers more freedom at the expense of guidance, and you get much less standardization as a result.
- vitaflo 2y agoThis is exactly why I love it because it's not opinionated. I've been doing frontend interfaces for 30 years and it's one of the few times I've felt that I can write things the way I want and not be forced down some preconstructed path. I get why some wouldn't like this but for me it's a breath of fresh air and why I continue to love working with it.
- h14h 2y agoAgreed. On re-read, my prior comment sounds almost negative towards React's lack of opinions. That couldn't be further from the truth! While I appreciated having a path laid out for me when I stated out, 10 years end I much prefer forging a path myself. Mastering these tools, and leveraging my own creativity in how I use them, is much more enjoyable.
- mhotchen 2y agoThanks both; you've inspired me to push on with learning React (Native)! Gonna be a fun weekend