🤹🏻♀️ Javascript/🥎 Typescript
타입스크립트 에러
ji-hyun
2022. 2. 25. 15:48
got Type 'void' is not assignable to type '() => void' in react typescript
I tried to pass the props like <Mycomp deleteAcc={handleDelete(accountId)} /> to another component. I write the props like interface AccProps { deleteAcc: () => void; } and call the fu...
stackoverflow.com
container
const handlePage = (page: number): void => {
setPage(page - 1);
// NOTE : 새로운 페이지 데이터 로딩
getGifticons({
variables: { skip: page * 10, take: 10 },
});
return (
<Presenter
page={page}
handlePage={() => handlePage(page)}
tableData={tableData(listData)}
/>
);
};
Type
export interface PropType {
page: number;
handlePage: (page: number) => void;
tableData: tableData;
}