TanStackT
TanStack4y ago
15 replies
verbal-lime

search prop is required in Link?

I got the TS error in the image but I did not expect that. Here is my code:

const routeConfig = createRouteConfig().createChildren((createRoute) => [
  createRoute({
    path: "/",
    component: () => {
      const [companyId, setCompanyId] = useState("");
      return (
        <>
          <input
            value={companyId}
            onChange={(event) => {
              setCompanyId(event.target.value);
            }}
          />
          <Link to={"/" + companyId}>Go to company</Link>
        </>
      );
    },
  }),
  createRoute({
    path: "/:companyId",
    component: () => {
      return <></>;
    },
  }),
]);
image.png
Was this page helpful?