question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Isomorphic / Server Side Rendering - Prop `id` did not match

See original GitHub issue

When using react-accessible-accordion in combination with Next.js I get the following warning on occasion Prop 'id' did not match. Server: "accordion__title-X" Client: "accordion__title-X". I have multiple pages with different react-accessible-accordions, and this is what causes the issue I believe. The server uuid is mismatched with the client uuid.

Would it be possible to add a ResetIdCounter similar to react-tabs? Or is there already a solution I am unaware of?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
ryami333commented, Feb 21, 2018

@HPieters, you should now be able to import { resetNextUuid } from 'react-accessible-accordion'. Let us know how you get on with the upgrade 😀

3reactions
dcheglakovcommented, Jan 21, 2021

Sorry for resurrecting this issue. I’ve tried resetNextUuid() it resets id, but I still have an error in the developer console.

Warning: Prop `id` did not match. Server: "accordion__heading-raa-0" Client: "accordion__heading-raa-1"
    at div
    at AccordionItemButton (webpack-internal:///./node_modules/react-accessible-accordion/dist/es/index.js:753:29)
    at Consumer (webpack-internal:///./node_modules/react-accessible-accordion/dist/es/index.js:598:5)
    at AccordionItemButtonWrapper
    at div
    at AccordionItemHeading (webpack-internal:///./node_modules/react-accessible-accordion/dist/es/index.js:845:5)
    at Consumer (webpack-internal:///./node_modules/react-accessible-accordion/dist/es/index.js:598:5)
    at AccordionItemHeading...

Here is my code

import PropTypes from 'prop-types'
import {
  Accordion,
  AccordionItem,
  AccordionItemHeading,
  AccordionItemButton,
  AccordionItemPanel,
  resetNextUuid,
} from 'react-accessible-accordion'

export default function Faq({ title, faq }) {
  resetNextUuid()
  return (
    <div className="py-32">
      <h2 className="pb-20 text-center">
        {title} <span className="text-red">FAQ</span>
      </h2>
      <Accordion>
        {faq.map((item, index) => (
          <AccordionItem key={item.id}>
            <AccordionItemHeading className="py-6 border-b border-suva-grey border-opacity-50">
              <AccordionItemButton>
                <h4>
                  <span className="pr-8 text-red">{`0${index + 1}`}</span>
                  {item.question}
                </h4>
              </AccordionItemButton>
            </AccordionItemHeading>
            <AccordionItemPanel>
              <p className="py-8 text-suva-grey lg:w-11/12">{item.answer}</p>
            </AccordionItemPanel>
          </AccordionItem>
        ))}
      </Accordion>
    </div>
  )
}

Faq.propTypes = {
  title: PropTypes.string.isRequired,
  faq: PropTypes.array.isRequired,
}

What I’m doing wrong?

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-select: How do I resolve “Warning: Prop `id` did not ...
try to add prop instanceId set as unique string and should work.
Read more >
React and React Router Server Rendering
Server side rendering a React app can provide a few different benefits including ... In the console, you'll see a warning Text content...
Read more >
Server Rendering with React and React Router
In this comprehensive, up-to-date guide, you'll learn how, why, and when to add server rendering to a React and React Router application.
Read more >
Localized Server-Side Rendering with React
The speed and SEO benefits of server-side rendering can outweigh its complexity. Learn here how to localize a React app made with SSR....
Read more >
Client & Server Side rendering
**You can find all the code for this post at **github.com/uidotdev/react-router-v5-server-rendering Server-side rendering AKA Isomorphic JavaScript AKA ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found