props ausprobiert
This commit is contained in:
parent
5bd5f0b6df
commit
39d001eed7
|
|
@ -54,7 +54,7 @@ function App() {
|
|||
</For>
|
||||
</select>
|
||||
<Dynamic component={options[selected()]} />
|
||||
<FooComponent />
|
||||
<FooComponent text="props test"/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
13
src/Foo.tsx
13
src/Foo.tsx
|
|
@ -1,5 +1,14 @@
|
|||
export function FooComponent(){
|
||||
import { createSignal} from "solid-js";
|
||||
|
||||
export function FooComponent(props){
|
||||
const [theme, setTheme] = createSignal("light")
|
||||
return (
|
||||
<div> Exported Foo Component</div>
|
||||
<>
|
||||
<div class={theme() === "light" ? "light-theme" : "dark-theme"}>
|
||||
This div's theme is determined dynamically!
|
||||
</div>
|
||||
<h1>props.text</h1>
|
||||
</>
|
||||
|
||||
);
|
||||
}
|
||||
Loading…
Reference in New Issue