-
Hi, I created a resource route: export const loader: LoaderFunction = async () => {
const cats = await getCategories()
console.log('Loader Called!')
return json({
cats,
})
} Then I call this in a modal const fetcher = useFetcher();
useEffect(() => {
if (fetcher.type === "init") {
fetcher.load('/categories');
}
if (fetcher.type === "done") {
console.log('Loaded!')
console.log(fetcher.data)
}
}, [fetcher]); The fetcher issues this GET request against the server:
But, the data it returns is a user object. The Somehow useFetcher is finding a user object somewhere, I've actually no clue what it's calling for that data! Any clue what's going wrong? IF not, how do I even debug this? Thanks, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Solved it, mostly. I changed the URL to go directly. I thought the default routing would work here, but it seems index.ts was ignored. |
Beta Was this translation helpful? Give feedback.
Solved it, mostly. I changed the URL to go directly. I thought the default routing would work here, but it seems index.ts was ignored.