Initial value of a variable in a reusable = attribute?

  • ssssadsadasd-1371882765754171453

    ssssadsadasd

    4 days ago

    [Here](https://toddle.dev/projects/moccasin_palpatine_chief_rook/branches/start/components/test234?canvas-height=800&canvas-width=800&rightpanel=events), I have a page with a selected-id variable. when a button is clicked I set this variable as a random number. I then use selected-id value as the value of the test attribute of random-test component.
    inside this component I have an id-variable that has initial value = test attribute.

    however, I expect the variable to have the value of the attribute when i click the button but it does not.
    anybody can explain what I am missing? thanks
  • max.kayr-1371885182340169811

    Max

    4 days ago

    This only sets the initial value. If you want the attribute and the variable to be in sync, you need to update the variable "On attribute change"
    1371885182528786513-image.png
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1
    1