passing data from component to main code

This commit is contained in:
Dmitry Borisenko
2021-08-14 17:37:43 +00:00
parent 64b6556a56
commit b167e40f8d
2 changed files with 27 additions and 1 deletions

View File

@@ -4,6 +4,9 @@
router.mode.hash(); // enables hash navigation method
//router.mode.memory(); // enables in-memory navigation method
import Card from "./Card.svelte";
import Input from "./Input.svelte";
let text = "";
const handleChange = value => (text = value); //
</script>
<main>
@@ -141,7 +144,10 @@
</Route>
<Route path="/test">
<Card title="Test section" />
<Card title="Testing card">
<Input onChange={handleChange} title="Input text" />
<h1>{text}</h1>
</Card>
</Route>
</div>
</ul>