useRouteData returning undefined
hi I'm trying to get the example from https://start.solidjs.com/core-concepts/data-loading to work but instead I always get this error
I've tried wrapping it in
Show
or doing if (!students) return;
but that causes hot module reloading to not work at all because I think it's never actually loading properly client side
8 Replies
you forgot to destructure students var like this
something to keep in mind is everything reactive in solidjs has a tuple form
[read, write]
nope I'm using
createRouteData
which supposedly returns it's data directly
createResource
is the one that would return a tuple, and I tried that one too
the call to useRouteData
is directly returning undefined in either case anyways
if I deconstruct it throws an errorWhats the error?
Also what do you see if you console.log students
students is not a function
logging students directly says it's undefined
Try wrapping the whole thing in a show block just to see if that works
that's one of the original things I tried
it does work, but hmr stops working for anything inside the show block
the console says it tries to hmr but nothing on the page actually updates
and this only happens when it's wrapped in that show
Hello everyone! I had a similar issue I could fixing by using a <Show> wrapper! Thanks @raqueebuddinaziz
Was this ever solved?