# useParams()&#x20;

### Functionality Overview:

This utility retrieves parameters specified in your route paths, identified by values following colons ("`:`") in route declarations. It returns an object with keys representing parameter names and values reflecting actual URL values. Streamlining dynamic content handling, it empowers you to seamlessly display diverse content, fetch data, or regulate functionalities based on the current URL.

> Here's an example:

Imagine you have a route `"/products/:id."` In your `ProductDetails` component, leveraging `useParams` is as simple as:

```typescript
import { useParams } from '@magicjs.dev/frontend';

function ProductDetails() {
    const { id } = useParams();
    const product = getProductById(id); // Fetch product based on id param

    // Render product details using the `product` object
    return (
        <div>
            <h1>Product Details for ID: {id}</h1>
            {/* ... Display product information fetched using the id ... */}
        </div>
    );
}
```

[Click here to refer GitHub.](https://github.com/skyslit/magicjs.dev/blob/main/packages/frontend/src/index.tsx#L289)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://skyslit.gitbook.io/magicjs/api-references/frontend/useparams.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
