render() {
        let self = this;

        // If there are no items to show, render a little status instead
        if(store.state.items.length === 0) {
            self.element.innerHTML = `<p class="no-items">You've done nothing yet 😢</p>`;
            return;
        }
        
        // Loop the items and generate a list of elements
        self.element.innerHTML = `
            <ul class="app__items">
                ${store.state.items.map(item => {
                    return `
                        <li>${item}<button aria-label="Delete this item">×</button></li>
                    `
                }).join('')}
            </ul>
        `;
        
        // Find all the buttons in the list and when they are clicked, we dispatch a 
        // `clearItem` action which we pass the current item's index to
        self.element.querySelectorAll('button').forEach((button, index) => {
            button.addEventListener('click', () => {
                store.dispatch('clearItem', { index });
            });
        });
    }
/**
     * React to state changes and render the component's HTML
     *
     * @returns {void}
     */
React to state changes and render the component's HTML
@returns {void}
React to state changes and render the component ' s HTML @returns { void }
render() {
        let self = this;
        if(store.state.items.length === 0) {
            self.element.innerHTML = `<p class="no-items">You've done nothing yet 😢</p>`;
            return;
        }
        self.element.innerHTML = `
            <ul class="app__items">
                ${store.state.items.map(item => {
                    return `
                        <li>${item}<button aria-label="Delete this item">×</button></li>
                    `
                }).join('')}
            </ul>
        `;
        self.element.querySelectorAll('button').forEach((button, index) => {
            button.addEventListener('click', () => {
                store.dispatch('clearItem', { index });
            });
        });
    }
render ( ) { let self = this ; if ( store . state . items . length === 0 ) { self . element . innerHTML = ` return ; } self . element . innerHTML = ` ${ store . state . items . map ( item => { return ` ${ item } ` } ) . join ( '' ) } ` ; self . element . querySelectorAll ( 'button' ) . forEach ( ( button , index ) => { button . addEventListener ( 'click' , ( ) => { store . dispatch ( 'clearItem' , { index } ) ; } ) ; } ) ; }
React to state changes and render the component's HTML
 @returns {void}
React to state changes and render the component ' s HTML @returns { void }
// If there are no items to show, render a little status instead // Loop the items and generate a list of elements // Find all the buttons in the list and when they are clicked, we dispatch a  // `clearItem` action which we pass the current item's index to