react-scrollbars-custom: Not working with react 18 and next js 12 getting element ref error

What is the current behavior?

Steps to reproduce it and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn’t have extra dependencies other than react-scrollbars-custom. Paste the link to your JSFiddle or CodeSandbox example below:

What is the expected behavior?

A little about versions:

  • OS:
  • Browser (vendor and version):
  • React:
  • react-scrollbars-custom:
  • Did this worked in the previous package version?

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 20
  • Comments: 15 (1 by maintainers)

Most upvoted comments

This issue happens due to React.StrictMode. Temporary fix is to disable it.

I’m trying to cut the time to rework the package atm

The latest release in the repository is from 2018 and the latest code push is from 2021 I think this repository is unmaintained. To solve these problems use another library: react-custom-scrollbars-2 It is practically the same but you have to change the name of some parameters and it seems to have more maintenance and updates.

I have same error. Please, fix it!

same here

I have same issue. For me helped change reactStrictMode to false in next.config.js, but this should be fixed in different way.

Error:

Error: Element was not created. Possibly you haven't provided HTMLDivElement to renderer's `elementRef` function.

https://github.com/xobotyi/react-scrollbars-custom/blob/6f9e391f30e191f20cf7603201ce7664e12dde01/src/ScrollbarTrack.tsx#L22-L30