Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const forceUpdate = useForceUpdate();
- // Register game state update loop.
- useEffect(() => {
- const interval = setInterval(() => {
- // Render the current state, then update it.
- forceUpdate();
- updateGameState();
- }, stateUpdateInterval);
- return () => clearInterval(interval);
- }, []);
- // {...}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement