Re:Rebuilding our tech stack for the new facebook.com
by 5cott0 on Friday May 08, 2020 @02:11PM
(#23117708)
So every React app can be effortlessly refactored to use whatever shiny new latest and greatest architecture abstraction React comes up with?
Re:Rebuilding our tech stack for the new facebook.com
by the_other on Friday May 08, 2020 @02:52PM
(#23118113)
No, and FB themselves discourage this in their documentation.
Regardless of upgrade paths, React <15 would still let you use HoCs w/out adding excess element nesting.
I don’t contest that the older React tended towards div-itis if you weren’t careful with how you used it. But this thread was about Higher Order Components (or wrapper functions), which don’t have any inherent effect on nesting.
HoCs don’t add nesting. If they do, you’re doing it wrong.
React <15 (2yrs old), did nudge you in the direction of div-itis, because all components that rendered something had to render a single root element. The more recent versions did away with that constraint. HoCs don’t even need to return markup; they’re functions which return functions. The general expectation should be that an HoC behaves like a factory for the components it wraps.