U
U
uRoot2021-04-01 16:19:57
typescript
uRoot, 2021-04-01 16:19:57

What data type to register for useCallback in the interface?

There is an interface:

export interface Pug {
  isBottom?: boolean
  onChangeLimit: any
}


The onChangeLimit function itself:
const onChangeLimit = useCallback((page: number) => {
    if (faq.isPending) return;

    setData(prev => ({
      ...prev,
      currentPage: page,
    }));
  }, [data]);


How it's used: What datatype should I write for onChangeLimit? On () => void gives an error, as I understand it is not the correct data type in this case.
const Pagination = (props: Pug) => { ... }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Lewandowski, 2021-04-01
@uroot

On () => void throws an error

Of course it does. You have a useCallbackfunction with an argument.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question