Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Using Params | React Router
Introduction to React
course content

Contenido del Curso

Introduction to React

Introduction to React

1. Getting Started: ES6
2. Getting Started: JSX
3. React in Practice
4. React Components
5. Controlling Data & Content
6. Hooks
7. React Router

bookUsing Params

We can access passed parameters in the URL using the useParams hook. Here is an example.

You can specify parameters in URLs using the colon operator followed by the name of the parameter :param. The parameter can be accessed inside the target component using the useParam hook. Notice how we enclose the bookid term inside braces { bookid } - it is because useParam returns an object and we retrieve the bookid by unpacking the object using this syntax.

carousel-imgcarousel-img
What is the function for accessing URL parameters?

What is the function for accessing URL parameters?

Selecciona la respuesta correcta

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 7. Capítulo 4
some-alt