#Conditional rendering under single route

3 messages · Page 1 of 1 (latest)

unkempt tusk
#

Hey,

Assume I want to have 2+ conditional "screens" rendered per route, is there a more concise way of doing it?
My naive solution is something like

export const Route = createLazyFileRoute('/')({
  component: () => {
    const someCondition = false
    return someCondition ? <Index /> : <IndexAlt />
  },
})

Could I use something like route masking for this? What are the alternatives?

mint silo
#

"concise" in which way?

#

what don't you like about your solution?