Error Duplicate Const Declaration in Switch Case Statement

Try wrapping the cases in blocks:

switch(condition) {
  case 'complex': {
    const query_url = `something`;
    … // do something
    break;
  }
  default: {
    const query_url = `something`;
    … // do something else
    break;
  }
}

Leave a Comment