props ausprobiert

This commit is contained in:
Marco Kittel 2025-06-10 21:01:50 +02:00
parent 5bd5f0b6df
commit 39d001eed7
2 changed files with 12 additions and 3 deletions

View File

@ -54,7 +54,7 @@ function App() {
</For>
</select>
<Dynamic component={options[selected()]} />
<FooComponent />
<FooComponent text="props test"/>
</>
);
}

View File

@ -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>
</>
);
}