I am using Effect hook to fetch the datas from server and these data are passed to the react table there i have used the same api call to load the next set of datas from server.
The other answers work of course, I just wanted to share a solution I came up with. I built this hook that works just like React's useState, but will only setState if the component is mounted. I find it more elegant because you don't have to mess arround with an isMounted variable in your component !
npm install use-state-if-mounted
const [count, setCount] = useStateIfMounted(0);
You can find more advanced documentation on the npm page of the hook.