Reader small image

You're reading from  Full Stack Web Development with Remix

Product typeBook
Published inNov 2023
Reading LevelIntermediate
PublisherPackt
ISBN-139781801075299
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Andre Landgraf
Andre Landgraf
author image
Andre Landgraf

Andre is a full stack developer from Germany. He graduated with an MS in Information Systems from the Technical University of Munich and was also awarded an MS in Computer Science from Sofia University in Palo Alto. Andre currently lives in Cupertino, California, and he works as a Software Engineer at LinkedIn. Andre loves learning, writing, and speaking about all things web. In his free time, he tutors aspiring developers and builds for the web.
Read more about Andre Landgraf

Right arrow

Using route parameters for dynamic routing

URLs often include parameters such as identifiers to specify associated resources. This allows the application to retrieve the right data for the request. In this section, you will learn how to work with URL parameters in Remix.

So far, we have created a route module for a hardcoded expenses details page (/dashboard.expenses.1.tsx). The number 1 in the URL refers to the expense with the expense identifier 1. However, the goal is to create a dynamic route module capable of handling variable identifiers. Luckily, Remix provides a convention for how to define a parameterized route segment.

Parameterized route segments

In Remix, dynamic segments of the URL are referred to as parameterized segments. We use the $ symbol to declare a route parameter. This turns the URL segment into a parameter that we can access and use to fetch data.

Let’s see how we can use a parameterized segment in BeeRich for the expenses details route:

...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Full Stack Web Development with Remix
Published in: Nov 2023Publisher: PacktISBN-13: 9781801075299

Author (1)

author image
Andre Landgraf

Andre is a full stack developer from Germany. He graduated with an MS in Information Systems from the Technical University of Munich and was also awarded an MS in Computer Science from Sofia University in Palo Alto. Andre currently lives in Cupertino, California, and he works as a Software Engineer at LinkedIn. Andre loves learning, writing, and speaking about all things web. In his free time, he tutors aspiring developers and builds for the web.
Read more about Andre Landgraf