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

386
Views
NextJs Prop style did not match

I'm building a sorting app and while displaying the array of numbers I get this warning:

Warning: Prop `style` did not match. Server: "height:{x}px" Client: "height:{y}px"

This is my code:

const SortingApp: React.FC = () => {


const fillWithRandom = (quantity: number):number[] => { // array of unique random numbers
    const results: number[] = [];
    while(results.length < quantity){
        let candidateInt = Math.floor(Math.random() * quantity) + 1
        if(results.indexOf(candidateInt) === -1) results.push(candidateInt)
    };

    return results }


const [data, setData] = useState(fillWithRandom(300))


return (
    <>
    <Layout>
    <Navbar />
    <div className="mx-5 flex gap-x-0.5 place-content-center">
        {data.map(x => {
            return (
                <div key={x} className={`w-1 bg-black`} style={{ height: `${x}px` }} />
            )
        })}
    </div>
    </Layout>
    </>
)

}

I'm curious to know why the props are different from server to client, since my code is not doing anything too fancy...

Thanks beforehand!

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!