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";
尝试删除true
的参数,因为它没有在文档中指定
throttle(500, (x)=>{console.log("help please")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.