You can run a polling logic inside a useEffect hook and update a state variable to save the state. Refer the example mentioned in the below post.
React hooks. Periodic run useEffect