Replies: 1 comment
-
function UserComponent(props: { user: User }) {
return (
<Switch>
<Match when={props.user.type === "member" && props.user} keyed>
{(user) => <p>{user.name}</p>}
</Match>
<Match when={props.user.type === "admin" && props.user}>
{(user) => <p>{user().name} | {user().email}</p>}
</Match>
</Switch>
);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi! I've read some discussions here about the problem of using discriminated unions with Show and Switch/Match, but all of them are about 1yo, so i wanna ask if there is any progress on that.
If you don't know what i'm talking about, here is an example:
Beta Was this translation helpful? Give feedback.
All reactions