Value returned from routeData is undefined
The value returned from routeData isn't defined, even after waiting before accessing
18 Replies
The code relating to the routeData is pretty much copied and pasted from the docs
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I've tried using it in JSX
Could it be due to where it is located in the layout tree?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
the function isn't even called
I've added a log, which doesn't run
Here's the JSX
I just added it there for testing
routeData doesn't even get called
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Done
Still undefined
and none of those logs are triggered
Apart from the one in the memo
Which prints undefined
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
I'm looking in the terminal
Yep :)
Could it be because it's in the same file as a Context Provider
or because it's before the routes in the tree
Actually, that sounds like it could be the problem
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yeah
Awesome
I guess I'll just fall back on my old way
Which needs artificial delay to work for some reason :)
Yeah
And even then it's not reliable
but at least it's only on initial page load
I've put it inside of a route and still nothing :(
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Yeah
Good idea
Thanks for all the help
and advice