T
TanStack9mo ago
xenial-black

Page title based on loaderData

Hello, is there any way i can put some data into a title? In a Route Component u would use
const employee: Employee = Route.useLoaderData();
const employee: Employee = Route.useLoaderData();
And then - employee.name, I want the name to be in the title using the Tanners solution with usage of a "head" function. I am using just TanStack Router not the TanStack Start.
No description
4 Replies
xenial-black
xenial-blackOP9mo ago
As soon as i posted this i figured out a solution, so if someone wonders how to do it:
No description
harsh-harlequin
harsh-harlequin9mo ago
why do you have to type cast here?
xenial-black
xenial-blackOP9mo ago
Oh.. you probably don't need to. The loaderData already have the correct type without the "type cast"
harsh-harlequin
harsh-harlequin9mo ago
yep

Did you find this page helpful?