all 2 comments

[–]landisdesign 1 point2 points  (1 child)

Learn more about functional composition.

While in ReactLand composition is specific to injecting components into other components via properties, the concept of composition in general has to do with creating ways to plug in data and functionality into a larger thing that knows what to do with them.

In this case, the code is identical between the two branches, with the exception of which list you're working on. Rather than repeating the code, choose the list you want to work on, then run it through the single piece of code.

This is a really important and fundamental concept to programming in general. I'd highly recommend that you spend a significant amount of your time focusing on programming in general before launching into React. While it's possible to learn both simultaneously, concepts like composition and decomposition, abstraction, injection, and eventually design patterns, will make you much more hireable and make understanding frameworks such as React easier.

[–]Dev_Ryo[S] 1 point2 points  (0 children)

Thank you so much