Get template name for switch

Hello,

how to get the page template name before it renders the html ?
I did this and it works but I use the slug what I don’t want to do…

const data = state.source.get(state.router.link)

    <Switch>
    <Loading when={data.isFetching} />
      <List when={data.isArchive} />
      <Post when={data.isPost} />
      <Pagedany when={data.route == '/dany/'}/> 
      <Page when={data.isPage} />
    </Switch>