Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with next.js #28

Open
mukhammadjon-s opened this issue Jul 28, 2022 · 1 comment
Open

Problem with next.js #28

mukhammadjon-s opened this issue Jul 28, 2022 · 1 comment

Comments

@mukhammadjon-s
Copy link

I am using this package in my next.js project but got this issue. I have copied all code from examples folder but still issue
`Unhandled Runtime Error
TypeError: Cannot read properties of null (reading 'append')

Call Stack
init
node_modules@unicef\react-org-chart\dist\index.js (19:3197)
e.value
node_modules@unicef\react-org-chart\dist\index.js (37:1738)
commitLifeCycles
node_modules\react-dom\cjs\react-dom.development.js (20663:0)
commitLayoutEffects
node_modules\react-dom\cjs\react-dom.development.js (23426:0)
HTMLUnknownElement.callCallback
node_modules\react-dom\cjs\react-dom.development.js (3945:0)
HTMLUnknownElement.sentryWrapped`

How can I fix it ? It is not compatible with Next.js ?

@lucbelliveau
Copy link

Just ran into this - it is looking for a dom element with an id of root. Quick fix is to add a <div id="root"> line to your _app.tsx file like this:

<Layout>
  {/* required by react-org-chart */}
  <div id="root">
    <Component {...pageProps} />
  </div>
</Layout>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants