How to get Table Row working with Tanstack Router? #8873
-
|
I'm trying to use the Table Row with a navigation in Tanstack Router. I've been naively trying to wrap the Row in import { Row } from "react-aria-components";
export const RowWithRouter = createLink(Row);
<RowWithRouter to="/admin/users/$id" params={{ id: item.id }}>
...
</RowWithRouter>I do get this error in the console when clicking the row but that doesn't seem helpful Is there a different way of achieving this? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
Not sure what exactly produces the error you get, but I think Maybe you can create a custom |
Beta Was this translation helpful? Give feedback.
Not sure what exactly produces the error you get, but I think
createLink()is only for actual anchor elements (a) which is the case for MenuItem and Link but not for table rows (as rows may contain interactive elements they can't be links).Maybe you can create a custom
Rowcomponent that accepts the relevant router props (seeValidateNavigateOptions), then renders the Row component of RAC and passes anonActioncallback that triggers navigation via TanStack Router'suseNavigate()hook.