Skip to content

Instantly share code, notes, and snippets.

@markgarrigan
Last active February 26, 2020 16:34
Show Gist options
  • Save markgarrigan/d6cc2111d145011c75fba3cd868a0f17 to your computer and use it in GitHub Desktop.
Save markgarrigan/d6cc2111d145011c75fba3cd868a0f17 to your computer and use it in GitHub Desktop.
Child directly nested in route. Riot.js v4
<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>
<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