Custom hook typing overload
Hello ! I am trying to implement the great example of tkdodo for react-router/react-query but unlike him here : https://tkdodo.eu/blog/react-query-meets-react-router#:~:text=the%20loader%20function%3A-,initial%2Ddata,-Copy , I want to use my custom hook. Since then, I have the ts error : charactersQuyery.data is possibly "undefined". I guess I have to implement some overload for my custom hook but I don't know how to write that down. Here is my implementation, can someone help me on that please. Thx
Characters.tsx
api/characters.ts
React Query meets React Router
React Query and React Router are a match made in heaven.
1 Reply
unwilling-turquoiseOP•3y ago
Found it