Closed Alex-Sichkar closed 2 years ago
Hi @Alex-Sichkar,
I think it's that you haven't set a key
on the clild component component, it's needed to keep track of the component instance when they are nested.
See the counter example on the homepage: https://www.tetraframework.com
I should add that to the docs!
Something like this:
@default.register
class Parent(Component):
state = True
@public
def toggle(self):
self.state = not self.state
template: django_html = """
<div {% ... attrs %}>
<div>Parent State: {{ state }}</div>
<button @click="toggle()">Toggle</button>
<div>
{% @ child key='inner-counter' / %}
</div>
</div>
"""
Yes, that worked, thank you!
No worries, let me know how you get on!
Hi @samwillis,
Example to reproduce:
https://user-images.githubusercontent.com/1922086/177634382-a0b1d5a2-8cf3-4ddf-9b29-9e6835e08286.mp4
Maybe I'm doing something wrong...