TanStackT
TanStack2y ago
6 replies
living-lavender

Using `to` as a input type

Im trying to create a helper function for rendering some react components that get wrapped in a <Link/>. However, I'm finding that I get a typescript error saying I need to always provide
params
.

I've got a route that uses path params. Is that why this is happening?

My code looks like this:

const TabOption = ({ label, path }: { label: string; path: LinkOptions['to'] }) => {
  return (
    <Link to={path} activeOptions={{ exact: true }} params>
      {({ isActive }) => (
        // my component
      )}
    </Link>
  );
};
Was this page helpful?