Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] Create a <Link /> component to navigate to a given resource. #6329

Open
alicanerdurmaz opened this issue Sep 13, 2024 · 0 comments · Fixed by #6330 or #6331
Open

[FEAT] Create a <Link /> component to navigate to a given resource. #6329

alicanerdurmaz opened this issue Sep 13, 2024 · 0 comments · Fixed by #6330 or #6331
Assignees
Labels
enhancement New feature or request

Comments

@alicanerdurmaz
Copy link
Member

alicanerdurmaz commented Sep 13, 2024

Is your feature request related to a problem? Please describe.

I want to navigate to the list page of the posts resource, to do that I need to do something like this:

import { useNavigation } from "@refinedev/core";
import { Link } from "react-router-dom";

export const MyComponent = () => {
  const { listUrl } = useNavigation();

  return <Link to={listUrl("posts")}>Go to posts list</Link>;
};

It would be easier to use if the <Link /> component accepts resource as a prop and resolves the path automatically.

Describe the thing to improve

The <Link /> component can take a go prop and use useGo to create the path. This way, I can use all useGo features and easily handle resource links.

import { Link } from "@refinedev/core";

export const MyComponent = () => {
  return (
    <Link
      go={{
        to: {
          resource: "posts",
          action: "list",
        },
        query: {
          filters: [
            {
              operator: "eq",
              value: "published",
              field: "status",
            },
          ],
        },
      }}
    >
      Go to the posts list
    </Link>
  );
};
@alicanerdurmaz alicanerdurmaz added the enhancement New feature or request label Sep 13, 2024
@alicanerdurmaz alicanerdurmaz self-assigned this Sep 13, 2024
@alicanerdurmaz alicanerdurmaz changed the title [FEAT] Navigate to resource with <Link /> component. [FEAT] Create a <Link /> component to navigate to a given resource. Sep 13, 2024
@BatuhanW BatuhanW modified the milestone: October Release Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment