Skip to content

Commit

Permalink
docs(infowindow): add dependencies to useCallback in example (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
luiscrjunior committed May 10, 2024
1 parent 2413e1f commit 5d68677
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/api-reference/components/info-window.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@ const MarkerWithInfoWindow = ({position}) => {

// clicking the marker will toggle the infowindow
const handleMarkerClick = useCallback(() =>
setInfoWindowShown(isShown => !isShown)
setInfoWindowShown(isShown => !isShown),
[]
);

// if the maps api closes the infowindow, we have to synchronize our state
const handleClose = useCallback(() => setInfoWindowShown(false));
const handleClose = useCallback(() => setInfoWindowShown(false), []);

return (
<>
Expand Down

0 comments on commit 5d68677

Please sign in to comment.