Skip to content

[Help!!] Can I have both props from parent and props from children instances? #2233

Answered by mdynnl
wootra asked this question in Q&A
Discussion options

You must be logged in to vote

https://playground.solidjs.com/anonymous/b9e09a8f-310a-466a-af35-dcda7bb07625

The pattern you're looking for might be this which solid-js already uses.
https://docs.solidjs.com/reference/components/switch-and-match

<Switch>
  <Match when={foo()}>is foo</Match>
  <Match when={bar()}>is bar</Match>
  <Match when={true}>just true</Match>
</Switch>

type EvalConditions = readonly [number, unknown?, MatchProps<unknown>?];
/**
* Switches between content based on mutually exclusive conditions
* ```typescript
* <Switch fallback={<FourOhFour />}>
* <Match when={state.route === 'home'}>

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@wootra
Comment options

Answer selected by wootra
Comment options

You must be logged in to vote
1 reply
@wootra
Comment options

Comment options

You must be logged in to vote
1 reply
@wootra
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants