1060
“Hire me” (i.imgur.com)
you are viewing a single comment's thread
view the rest of the comments
[-] DrQuint@lemm.ee 4 points 1 year ago* (last edited 1 year ago)

If there's a parent component that has some data that it expects to always receive from its children, then that data should be in the parent's state and the children should receive it and maybe some relevant methods as props. Even if it's an unknown number of children. Don't muck with useContext for basic inheritance stuff, you'll mess with the render cycle for no good reason.

Now, if we're talking about a very distant "top" component, that's fine, it's what it was made for. Although many people end up using stores if it's some data with broad impact (like user data)

this post was submitted on 21 Aug 2023
1060 points (98.2% liked)

Programmer Humor

19623 readers
1 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS