Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

196
Views
Uncaught TypeError: Cannot read properties of undefined (reading 'components') in pure JS app

I have an issue that I cant solve. Writing pure js application and then have a error:

Uncaught TypeError: Cannot read properties of undefined (reading 'components')
    at new Excel (Excel.js:4:31)
    `at Header._createSuperInternal` (Formula.js:3:1)
    at new Header (Header.js:3:1)
    at Excel.js:11:25
    at Array.forEach (<anonymous>)
    at Excel.getRoot (Excel.js:10:21)
    at Excel.render (Excel.js:19:26)
    at Module../index.js (index.js:12:7)
    at __webpack_require__ (bootstrap:24:1)
    at startup:7:1

My code at Excel.js:


       export class Excel {
      constructor(selector, options) {
        this.$el = document.querySelector(selector)
        this.components = options.components || []
      }
    
      getRoot() {
        const $root = document.createElement('div')
    
        this.components.forEach(Component => {
          const component = new Component()
          $root.insertAdjacentHTML('beforeend', component.toHTML())
        })
    
        return $root
      }
    
      render() {
        this.$el.append(this.getRoot())
      }

} 

at Formula.js for example i tried to render some text in pages, code:


        import {Excel} from '../excel/Excel'
    
    export class Formula extends Excel {
      toHTML() {
        return '<h1>Formula</h1>'
      }
    }

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!