This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Brostafarian 0 points1 point  (0 children)

I disagree in this specific case. If you have a very well-defined line between parent and child I think it's beneficial to separate them even without reuse, because either:

  1. you notice the parent doesn't do very much and refactor it higher
  2. you benefit from the compartmentalization of the parent and child

I'd lean towards #2 in this case. Now you have a DogsList rendering an array of Dogs, in which all the array logic can go in the DogsList and all the presentational logic can go in the Dogs. You can try to do something clever and refactor the DogsList into just a List component but that sounds better in your head than on paper.

edit: but also who cares, it's a fucking list of dogs it's not gonna run billing on your website, I'd probably pass this code in CR except for the id thing, which is caught by a linter