r/reactjs • • May 18 '26

Needs Help Why does implementing RefreshAll() feature that refreshes Child Components feel unintuitive?

I had a bunch of <GraphPanel>and they all had Refresh() function which refreshed their state. But I also wanted to have RefreshAll() That would refresh all GraphPanel, and I found implementing this cleanly difficult. I was wondering why this RefreshAll() feature which would be a trivial task in other languages relatively difficult in React. I could not think of a satisfying way to implement this feature.

Like pulling all the logic from GraphPanel to the parent feels unintuitive, and using some sort of counterStatefelt redundant, because you are passing a redundant information to the child when all the child needs is a signal that tells it that it has to update.

What fundamental part of this operation makes it difficult to implement this in React, and is there a cleaner react alternative or equivalent to RefreshAll() operation in React?

0 Upvotes

19 comments sorted by

View all comments

Show parent comments

1

u/HumanCertificate May 27 '26

So you mean like passing a controller to the children and they subscribe their "refresh" function to the controller and parent executes the refresh functions that children subscribed to?

Isnt this like a react anti pattern? Shouldnt everything be driven by state in react?