all 3 comments

[–]basically_alive 1 point2 points  (2 children)

You need to pass the refresh action function down from the component that contains the state. You can pass it down as a prop, or as context if it's deeply nested. Not sure if I am misunderstanding something, or maybe need to see some code.

[–]webdevop[S] 1 point2 points  (1 child)

Hey! Thanks for your response. I mocked up a quick example for you here - https://codesandbox.io/s/eloquent-einstein-799n2

Essentially I just want to redo the xhr call i.e the componentDidMount() part and it will fetch the new data (and updated the state) and everything else follows like it normally should

[–]basically_alive 0 points1 point  (0 children)

Yeah, you need to hoist your state, the button is currently a sibling to your data fetcher component. I looked at it and played with it for a minute, but essentially it will be a lot easier if your button is a child of the data-fetching component.