#Can't use `useRouteData`
19 messages · Page 1 of 1 (latest)
are you passing the data function to the data prop?
does it work when the component is not lazy?
@kindred garden yes and no
I've tried without lazy import, nothing seems to work . Whenever I comment the useRouteData, query function runs as well and everything's fine.
I just want to know, what can be the cause of that kind of behaviour. I'm creating Solid components in kinda different way so to say, without JSX.
can you screenshot the router & component code?
from what I understand route data is a fully runtime mechanism, so JSX shouldn't be important
or, if you call useLocation or any other primitive that hooks into existing router in that component, do you get the same error, or is it only with useRouteData?
For demonstration purposes I've moved Route component back to solid and now Component is PureScript generated component, which is being composed with the functions of second screen.
so basically my Component is a function, which returns createComponent and inside createComponent's function, I have useRouteData
how do you use dynamic?
this doesn't look right
I would always do
get children() {
return cs
}
also I feel like this is important ☝
because if the children are executed too early - not by the <Router> but by the <Route> or something like that, none of the Router hooks will work
I’m using dynamic to create basic dom nodes, div, span, etc…
Regarding children being executed before, when I’m logging something from that component, I only see those logs, whenever I’m getting redirected to that page, so I don’t think that they are executed earlier.
Will check it out a bit later, thanks for your time. I’ll get back soon.
useLocation doesn't work as well, I guess something's executing too early and that's causing the issue?
@kindred garden
but that seems like illogical, my Router invocation is waay up there. I'm using SolidStart template and as you can see, that Component is being called even under Routes