How to navigate to a different page when we click on Breadcrumb option?

2 Answers 252 Views
Designs, skins, themes
Abhishek
Top achievements
Rank 1
Iron
Iron
Iron
Abhishek asked on 28 Aug 2023, 07:51 AM
I am using a kendo react breadcrumb component. It has 3 menu items. Home -->Profile-->Details.  If i click on Profile, i want to navigate to Profile.jsx page. How can i do it? i am not getting enough examples on how navigation works in breadcrumbs.  Kindly help me

2 Answers, 1 is accepted

Sort by
0
Filip
Telerik team
answered on 28 Aug 2023, 11:41 AM | edited on 28 Aug 2023, 01:52 PM

Hi, Abhishek,

It is possible to add routes to the Breadcrumb component by using react-router-dom since the component does not have inbuilt routing implemented.  We created a runnable example showing how this can be achieved:

https://stackblitz.com/edit/react-n7v9yp-ilzpfy?file=app%2FBreadcrumbContainer.jsx

Here we are targeting the selected item route and pushing it to the history object, then after rendering its children via props the Router changes between the components. 

I hope this example will be useful in your use case. In case it isn't feel free to tell us what issues you are experiencing and we will be glad to assist you further.

Regards,
Filip
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources!

Abhishek
Top achievements
Rank 1
Iron
Iron
Iron
commented on 28 Aug 2023, 01:13 PM

I am already using a drawer component in the application. So when i try to implement the above mentioned code, i am getting a warming like this:   "Hash history cannot PUSH the same path; a new entry will not be added to the history stack"
Filip
Telerik team
commented on 29 Aug 2023, 01:53 PM

Hi, Abhishek,

This error occurs when the same path is being pushed into the history object, I can recommend making sure that different paths are being pushed from both the Drawer and the Breadcrumb component.

If the error still persists after that, can you send a runnable reproducible example with the error? This will helps us debug it locally and see if a suitable workaround exists.

Regards,
Filip

0
Tanu
Top achievements
Rank 2
answered on 04 Sep 2023, 09:16 AM | edited on 04 Sep 2023, 09:16 AM

Hii Abhishek,

As per my knowledge, to enable page navigation when clicking on a Kendo React breadcrumb option, you must implement routing in your React application. First, install and set up a routing library like React Router. Define routes for your Home, Profile, and Details pages. Next, integrate the Kendo React breadcrumb component, making sure each breadcrumb item is a link to its respective route. When a user clicks a breadcrumb link, React Router will automatically handle the navigation, directing them to the desired page, such as Profile.jsx in your case.

I will check this link- 

https://stackblitz.com/edit/react-n7v9yp-ilzpfy?file=app%2FBreadcrumbContainer.jsxsplunk course

so you can also check this , it's really helpful

 

I hope this will help you.

Tags
Designs, skins, themes
Asked by
Abhishek
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Filip
Telerik team
Tanu
Top achievements
Rank 2
Share this question
or