-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Description
Hi,
Relates to LitElementHaunted usage.
Could you explain why when a state variable is passed to a child component (as per example code) there is no re-rendering of the child component? Maybe I'm using this incorrectly but this seems the most intutive usage..
import { html } from 'lit-element';
import { litHaunted } from './lit-haunted-element.js';
import { useState } from 'haunted'
const CounterChild = litHaunted(({count}) => {
return html`
<h1>${count}</h1>
`;
});
window.customElements.define('my-counter-child', CounterChild);
const Counter = litHaunted(() => {
const [count, setCount] = useState(0);
return html`
<p>A paragraph</p>
<button type="button" @click=${() => { setCount(count + 1)}}>Increment</button>
<p><strong>Count:</strong> ${count}</p>
<div>
<my-counter-child .count=${count}></my-counter-child>
</div>
`;
});
window.customElements.define('my-counter', Counter);Metadata
Metadata
Assignees
Labels
No labels