Skip to content

Commit

Permalink
Fix missing dependency array
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiasBuelens committed Feb 14, 2024
1 parent 2a87327 commit 4fd1c0d
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions docs/examples/react.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,13 @@
// inside a THEOplayer <DefauLtUI> or <UIContainer>.
const player = useContext(THEOplayerReactUI.PlayerContext);
// Keep track of the player's current time.
const subscribe = useCallback((callback) => {
player?.addEventListener(['timeupdate', 'seeking', 'seeked'], callback);
return () => player?.removeEventListener(['timeupdate', 'seeking', 'seeked'], callback);
});
const subscribe = useCallback(
(callback) => {
player?.addEventListener(['timeupdate', 'seeking', 'seeked'], callback);
return () => player?.removeEventListener(['timeupdate', 'seeking', 'seeked'], callback);
},
[player]
);
return useSyncExternalStore(
subscribe,
() => player?.currentTime ?? 0,
Expand Down

0 comments on commit 4fd1c0d

Please sign in to comment.