React native with typescript – how to use the useRoute from @react-navigation/native with typescript

Just did this yesterday!

TLDR:
First you need to define a type with each screen name and the params it receives:

type ParamList = {
  Detail: {
    incident: IncidentProps;
  };
};

Then you use that param and the screen name in RouteProp:

const route = useRoute<RouteProp<ParamList, 'Detail'>>();

Here are the docs explaining all this https://reactnavigation.org/docs/typescript

Leave a Comment