Last active
February 26, 2020 16:34
-
-
Save markgarrigan/d6cc2111d145011c75fba3cd868a0f17 to your computer and use it in GitHub Desktop.
Child directly nested in route. Riot.js v4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<app> | |
<h1>Hello</h1> | |
<router> | |
<ul> | |
<li> | |
<a href="/child">Child</a> | |
</li> | |
</ul> | |
<route path="/child"> | |
<child something={ doSomething }></child> | |
</route> | |
</router> | |
<script> | |
export default { | |
doSomething(thing) { | |
console.log(thing) | |
this.update() | |
} | |
} | |
</script> | |
<app> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<child> | |
<h2>Hello from child</h2> | |
<script> | |
export default { | |
onMounted(props, state) { | |
props.something('child') | |
} | |
} | |
</script> | |
</child> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment