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

126
Views
Next js shows a 0 at the top for one second on load page content

in my nextjs app, when the page loads there is a 0 in the top left corner for a split second. In that page, I get some data from Sanity CMS with getStaticProps and return the content.. I notice that even if I return a empty fraction the 0 appears.

  return <>{Object?.keys(finalContent).length && <></>}</>;

If I return just the empty fraction without checking for

Object?.keys(finalContent).length && 

the 0 is gone

  return <></>;  // no 0 in the page

Anyone know how to remove it?

enter image description here

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I assume with Object?.keys(finalContent).length you want to ensure that the data was fetched. Apparently the '0' of the object keys length doesn't count as a falsy value here, so it gets rendered as a value, just as if you would say some arbitrary value/number like 7 && <></>.

try this:

  return <>{Object?.keys(finalContent).length != 0 && <></>}</>;

It'll ensure that the expression counts as a boolean

about 4 years ago · Santiago Trujillo 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!