Riot: Component's Opts should be deep copy ?

Created on 12 Oct 2016  路  1Comment  路  Source: riot/riot

The Data passed to a component should be deep copy, otherwise if we have mutilple instance, they may effect on each other.

  1. Describe the issue:
    gif
  2. Reproduce

DEMO

  • Click the third item of second instance
  • Click the second item of first instance, then we can find the checkbox status of the third item is wrong(Caused by the second instance's status)
answered discussion question

Most helpful comment

@liangshuai what you are doing does not make really sense. Riot will not manage your data layer, you are mounting 2 tags with the same data and riot just uses your object. Other frameworks does not even allow you to do that https://jsfiddle.net/9t5t8xnn/ so I think this design decision is perfectly ok

>All comments

@liangshuai what you are doing does not make really sense. Riot will not manage your data layer, you are mounting 2 tags with the same data and riot just uses your object. Other frameworks does not even allow you to do that https://jsfiddle.net/9t5t8xnn/ so I think this design decision is perfectly ok

Was this page helpful?
0 / 5 - 0 ratings