When refference of opts is changed, the component mount again.
For example, there is list loop like this.
<component each={v in datas} data={v}/>
this.datas = [
{ value: 0 },
{ value: 1 }
];
If datas is updated like this, component mounts again.
this.update({
datas: [
{ value: 2 },
{ value: 3 }
]
});
I created sample.
https://codepen.io/kwst/pen/qVgedv
The process sequence is here.
this.datas is changedunmount of component is calledmount of component is calledI expect this.
this.datas is changedshouldUpdate of component is calledshouldUpdate return true, component is updatedI think this behavior is key of React. Does Riot has function like React key?
On React, the component doesn't mount again.
https://codepen.io/kwst/pen/Zawgxq
https://codepen.io/kwst/pen/qVgedv
Chrome/Mac os x 10.12.6
3.7.4
How would you tag this issue?
@GianlucaGuarini Why did you add invalid label? Please tell me the reason.
@SatoshiKawabata because this info is in our doc http://riotjs.com/guide/#key
@GianlucaGuarini Oh key api was icluded from v3.7.x. I didn't know that. My issue is resolved. But it's a little strange that riot's updating is different from React's.