Skip to content

Commit

Permalink
fixed debounceData function definition
Browse files Browse the repository at this point in the history
prevented call to debounce function on every state change
  • Loading branch information
nvojnovic authored and bell-steven committed Nov 8, 2020
1 parent 7f1c05a commit 915fce6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions GooglePlacesAutocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
import Qs from 'qs';
import React, {
forwardRef,
useCallback,
useMemo,
useEffect,
useImperativeHandle,
useRef,
Expand Down Expand Up @@ -522,7 +522,7 @@ export const GooglePlacesAutocomplete = forwardRef((props, ref) => {
};

// eslint-disable-next-line react-hooks/exhaustive-deps
const debounceData = useCallback(debounce(_request, props.debounce), []);
const debounceData = useMemo(() => debounce(_request, props.debounce), []);

const _onChangeText = (text) => {
setStateText(text);
Expand Down

0 comments on commit 915fce6

Please sign in to comment.