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

214
Views
TypeError: Cannot read properties of undefined (reading 'length') in ReactJs(MERN Stack)

My error in the browser is as follows,

showbtdropIn
D:/mern/projfrontend/src/core/PaymentB.js:38
  35 | 
  36 | const showbtdropIn = () => {
  37 |  return (
> 38 |      <div>
     | ^  39 |          {info.clientToken !== null && products.length > 0 ? (
  40 |              <div>
  41 |                  <DropIn
View compiled

Paymentb
D:/mern/projfrontend/src/core/PaymentB.js:106
  103 | 
  104 | return (
  105 |     <div>
> 106 |         <h3>Your bill is {getAmount()} $</h3>
      | ^  107 |        {showbtdropIn()}
  108 |     </div>
  109 | );
View compiled

▶ 18 stack frames were collapsed.
(anonymous function)
D:/mern/projfrontend/src/core/PaymentB.js:28
  25 | getmeToken(userId, token).then((info) => {
  26 |  // console.log("INFORMATION", info);
  27 |  if (info.error && info) {
> 28 |      setInfo({ ...info, error: info.error });
     | ^  29 |  } else {
  30 |      const clientToken = info.clientToken;
  31 |      setInfo({ clientToken });
View compiled

All the related code files are shared in this link click here for files

I am not getting where did I miss, the length is already defined, even the getAmount is good without any error in logic or working, I am not getting why is it displaying undefined properties, I am new to the MERN stack, Can anyone help me? And help me to understand this error, and the concept I am missing.

If you find the question good Give an +1 upvote so that it helps others.

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!