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

Make navigation in template use Link tags rather then A tags. #254

Open
npenza opened this issue Aug 21, 2024 · 1 comment
Open

Make navigation in template use Link tags rather then A tags. #254

npenza opened this issue Aug 21, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@npenza
Copy link

npenza commented Aug 21, 2024

Currently, the template uses a tags for its navigation items.

{navigation.map((item) => (
<a
key={item.name}
href={item.href}
className='text-sm font-semibold leading-6 text-gray-900 duration-300 ease-in-out hover:text-yellow-500 dark:text-white'
>
{item.name}
</a>

This causes the page to reload when navigating around items. Example:

example-a-tag.mov

My fix is quite a minor one. Replace the a tag used in the navigation mapping with the link tag from react-router-dom. Doing so creates a better nav experience for users (both mobile and nav will need to be updated). Example:

Screenshot 2024-08-22 at 8 06 29 AM
link-tag-example.mov

Currently, Link is being used in this file from the wasp router, which I believe can only point to files defined in the main.wasp file. Are we able to replace the wasp version of Link with the react-router-dom, which will allow links to be defined and used within the nav file?

I would love to work and contribute on this. Its a small improvement, but having to reload pages in a react-app takes away from that seamless SPA experience.

@vincanger
Copy link
Collaborator

hey @npenza, go for it!

And, yes, if you're not using a route defined in the wasp config file, then you can use react-router-dom's Link component instead.

@vincanger vincanger added the enhancement New feature or request label Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants