Riot loop rendering

by gianlucaguarini

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/riot/2.6.7/riot+compiler.js"></script>
<test></test>

<script type="riot/tag">
    <test>
        <button onclick={ change }>Change</button>
        <br/>
        <list  each={value in obj} text={ value } ></list>
        
        this.obj = {
          'key1': 'value1',
          'key2': 'value2'
        }
        this.change = function() {
          this.obj = {
            'key3': 'value3'
          }
        }
    </test>
</script>

<script type="riot/tag">
    <list>
        <label>{ opts.text }</label>
    </list>
    
</script>

JavaScript

riot.mount('*')