Is there a way in React to just refresh a component not the window but the component itself? This is so I can re-trigger a react-query. I know I can use useEffect()
but what would be the way to do it?
So I know I could do, something like:
useEffect(() => {
setFetchData(result);
}, [result]);
This would trigger the component to re-render when result
changes. But how can you have a button that would manually refresh the component or re-render it.