solidjs / solidjs/solid-router
[feature request] Add 'params' prop to the 'A' component
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- TypeScript
- Stars
- 1.3k
- Forks
- 180
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 19
Description
Describe the bug
Not a bug, it's a feature request.
I think that it would be nice to add a params prop to the A component, for example:
<A href="/users/:id" params={{ id: userId }} />
I'm proposing this for 2 reasons:
- It seems like a nicer and more maintainable API when working with an object containing all paths. For example:
<A href={routes.user} params={{ id: userId }} />
- This would be a nice combination with named routes proposed here https://github.com/solidjs/solid-router/issues/61
This is the API I'm thinking about:
<A name="user" params={{ id: userId }} />
When working with named routes there must be some way of providing params.
An alternative API could be
<A href={{ path: routes.user, params: { id: userId } }} />
<A href={{ name: 'user', params: { id: userId } }} />
Your Example Website or App
Steps to Reproduce the Bug or Issue
Expected behavior
Screenshots or Videos
No response
Platform
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the A component and the proposed named-routes issue (#61), then compare the href, name, and alternative object-shaped APIs described here. A contribution is done when the project has chosen and implemented a params API for route links with coverage for dynamic path values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100