News for hackers. Stuff that matters.
Re:React best practices by tacotacotaco on Monday May 03, 2021 @05:53PM (#27031239)
No. This person seems not understand composition. This pattern can be useful but is poorly employed in this example. If you are interested in good practices please read Eric Elliot's Composing Software https://medium.com/javascript-scene/composing-software-the-b...
Re:React best practices by zarathustreal on Monday May 03, 2021 @06:01PM (#27031354)
100% this person is misusing composition. Especially in the React Component sense. There seems to be some key details of React missing from the original posters' understanding, and I highly recommend anyone reading this to look into functional programming to understand what a React component is and does and how to build higher-level abstractions like the one(s) mentioned by this original poster the correct way. Higher-order functions and a real state management library are the obvious solutions to these problems
Re:React best practices by ZephyrBlu on Monday May 03, 2021 @06:14PM (#27031509)
Can you elaborate on why this is a poor use of composition?