solidjs / solidjs/solid-router

[feature request] Add 'params' prop to the 'A' component

Open
#216 7 comments 0 reactions 0 assignees View on GitHub

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 }} />
<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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.