react-router icon indicating copy to clipboard operation
react-router copied to clipboard

[Docs]: Document useParams return key for wildcard param (*)

Open eddywashere opened this issue 3 years ago • 1 comments

What is the new or updated feature that you are suggesting?

Add documentation for how to access the wildcard value in a route when using useParams.

Example:

// ex: `/articles/:id/*`;
// url - `/articles/1/tab/path`
const {*, id} = useParams();
// * = 'tab/path'

//or
const params = useParams();
console.log(params['*']);
// * = 'tab/path'

Why should this feature be included?

It is not clear that a param without a : will be part of the useParams return object. It seems like a special case that would be helpful to document. This could also be helpful to track if this changes and how to migrate to/from.

Thanks!

eddywashere avatar May 12 '22 20:05 eddywashere

Sorry folks, our stale bot went rogue and closed this 😅

machour avatar May 01 '23 14:05 machour