Skip to content

Provide typesafe NavLink in Wasp SDK #4101

@FranjoMindek

Description

@FranjoMindek

react-router's NavLink is different than Link.
It also provides helpers to style the link depending on navigation state.
E.g., in open-saas we do (look at the clsasName callback):

<NavLink
  to="/admin/users"
  end
  className={({ isActive }) =>
    cn(
      "text-muted-foreground hover:bg-accent hover:text-accent-foreground group relative flex items-center gap-2.5 rounded-sm px-4 py-2 font-medium duration-300 ease-in-out",
      {
        "bg-accent text-accent-foreground": isActive,
      },
    )
  }
>

The problem is that we must import it from react-router, which makes it not type-safe.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions