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

234
Views
× TypeError: Cannot read properties of undefined (reading 'name')

The problem is undefined of currentPackage. render() { const { hasAccounts, asideClassesFromConfig, disableScroll, htmlClassService, currentPackage, user, } = this.props; const isActive = checkStatus(user?.status);

const packageLogo = currentPackage.name && currentPackage.logo && (
  <div className="vk-inductee-button-wrapper">
    <div className="vk-inductee-button-image-wrapper">
      <img
        src={currentPackage.logo}
        className="vk-inductee-button-image"
        alt="inductee-img"
      />
    </div>
    <div className="vk-inductee-button-label">
      <span>{currentPackage.name}</span>
    </div>
  </div>
);

return (
  <>
    <button className="kt-aside-close" id="kt_aside_close_btn">
      <i className="la la-close" />
    </button>
    <div
      id="kt_aside"
      ref={this.asideOffCanvasRef}
      className={`kt-aside ${asideClassesFromConfig} kt-grid__item kt-grid kt-grid--desktop kt-grid--hor-desktop`}>
      <Brand />
      <div
        id="kt_aside_menu_wrapper"
        className="kt-aside-menu-wrapper kt-grid__item kt-grid__item--fluid">
        <AsideDropdown />
        {isActive ? (
          <Link to="/shop/my-packages">{packageLogo}</Link>
        ) : (
          packageLogo
        )}
        {disableScroll && <Menu htmlClassService={htmlClassService} />}
        {!disableScroll && (
          <PerfectScrollbar
            options={{ wheelSpeed: 2, wheelPropagation: false }}>
            <Menu htmlClassService={htmlClassService} />
          </PerfectScrollbar>
        )}
        {hasAccounts && <AsideFooter />}
      </div>
    </div>
  </>
);

} }

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

you might do something like

const packageLogo = currentPackage && currentPackage.name && currentPackage.logo && (
  <>
   //your code
  </>
)

the problem is that currentPackage is undefined, but you're checking if currentPackage.name is truthy. Since the property name doesn't exist on undefined, you get that error. You should just need to check that currentPackage itself is truthy before checking specific properties on it.

about 4 years ago · Juan Pablo Isaza Report
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!