Updating a part of a Riot.js tag

published Apr 04, 2019 02:55   by admin ( last modified Apr 07, 2019 11:23 )

Edit 2019-04-07: This does not work!

 

In order to get a less jumpy page, I'm looking at how to render just a sub part of a Riot.js tag. According to this conversation it should be possible. The example given is this:

var item = this.tags['big-data-tag'].tags.item[0]
item.first_name = 'jack'
item.update()

I think it could be adapted to work like this, untested by me:

 

<maintag>
    <subpart>
        { onlyupdatethis}
    <subpart>
Some other stuff that is static

   <script>
   const tag = this

     this.on('mount', function () {
       stateManager.subscribeToUpdates(function(state){
          tag.tags.subpart.update()
        })
       }   
      )

   </script>

</maintag>