JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://cdn.ractivejs.org/edge/ractive.js"></script>
<main></main>
<script id='template' type='text/ractive'>
<button on-click='moveTo:1'>move to section 1</button>
<button on-click='moveTo:2'>move to section 2</button>
<button on-click='moveTo:3'>move to section 3</button>
<div id="section1">
<h1> Section 1 </h1>
<div class='target' data-target='1'>
<subcomponent/>
</div>
</div>
<div id="section2">
<h1> Section 2 </h1>
<div class='target' data-target='2'></div>
</div>
<div id="section3">
<h1> Section 3 </h1>
<div class='target' data-target='3'></div>
</div>
</script>
<script id='subcomponent' type='text/ractive'>
<p>I'm a subcomponent</p>
<p>...</p>
</script>
JavaScript
Ractive.components.subcomponent = Ractive.extend({
template: '#subcomponent'
});
var ractive = new Ractive({
el: 'main',
template: '#template'
});
var subcomponent = ractive.findComponent( 'subcomponent' );
ractive.on( 'moveTo', function ( event, target ) {
subcomponent.insert( '.target[data-target="' + target + '"]' );
});