0

I came across this operator ?. for the first time in a react-native project. What is this operator called and what does it do.

function getHeaderTitle(route) {
  const routeName = route.state?.routes[route.state.index]?.name ?? INITIAL_ROUTE_NAME;

  switch (routeName) {
    case 'Home':
      return 'Home';
    case 'Links':
      return 'Links';
  }
}
Ejaz
  • 1,504
  • 3
  • 25
  • 51

0 Answers0