How can I create a layout component with react router v6 in react

Can you suggest me a pattern what I can use to render header based on some condition.

image