Skip to content
Discussion options

You must be logged in to vote

Since loaders are independent, you will either need to pass the actual id to your $name route (via search params), or query data by internal id, to get the id, then query by id.

Option 1

// list.tsx
<Link to={`${internal_id}${name}?id={id}`>${name}</Link>

// $name.tsx
export const loader: LoaderFunction = async ({request}) => {
  // url = /some_internal_id/some_name?id=some_id
  const url = new URL(request.url)
  const id = url.searchParams.get('id')
  const data = await queryById(id)
}

Option 2

// list.tsx
<Link to={`${internal_id}${name}`>${name}</Link>

// $name.tsx
export const loader: LoaderFunction = async ({request, params}) => {
  // url = /some_internal_id/some_name
  const { in…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@stefanisarie
Comment options

@kiliman
Comment options

@JTMax1
Comment options

@kiliman
Comment options

@kiliman
Comment options

Answer selected by machour
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants