#Is params from child route can be accessed from parent route.

1 messages · Page 1 of 1 (latest)

jagged current
#

Let say I have two routes /$teamId and /$teamId/$channelId. Is it okay for me get channelId from $teamId loader like this.

// In /$teamId
export const loader = ({params} : LoaderArgs) => {
  const {teamId, channelId} = params;
 
}
ebon spindle
#

I'm not sure it's safe, since channelId won't be defined on your /$teamId route

#

you'll have to test to see if that param is set, but how come you need channelId in /teamId ?

#

maybe there's some refactoring to do

jagged current
#

that param is currently being set. But I am not sure whether it has guarantee to stay that way i.e this behaviour won't change in minor version jump

ebon spindle
#

I don't think it will ever change

jagged current
#

Got it