I have a LitElement that represents a file upload for multiple files. This uses a sub-component that represents each file.
I'm struggling to find examples of the best practice for propagating changes into the sub component using LitElements as it appears to be very different from Polymer 3
Here's a cut down example of what I'm trying:
import './uploadFile.js';
class Upload extends LitElement {
...
static get properties() { return { files: Object } }
_render({files}) {
return html`
<input type="file" multiple onchange="...">
${this.renderFiles(files)}`
}
renderFiles(files) {
const filesTemplate = [];
for (var i = 0; i < files.length; i++) {
filesTemplate.push(html`
<upload-file file="${files[i]}"></upload-file>
`);
}
return filesTemplate;
}
}
When I update the status of a file the upload component re-renders but the upload-file component does not.
What am I doing wrong here? There aren't may examples of LitElement usage out there.
TIA