Assume I have the following component:
<TouchableOpacity
style={...}
onPress={() => func(x)}
>
<TouchableOpacity/>
and func() defined as follows:
const func = (x) => {console.log("help please")}
This work as it should. However, once I memoize func() as follows:
const func = useMemo(()=>throttle(500,true, (x)=>{console.log("help please")}
I get the following error:
TypeError: callback.apply is not a function. (In 'callback.apply(self, arguments_)', 'callback.apply' is undefined)
Note: throttle was imported:
import { throttle } from "throttle-debounce";
CodePudding user response:
Try removing the true
argument as it isn't specified in the docs
throttle(500, (x)=>{console.log("help please")