Skip to content

scrollableTarget throws error Type 'HTMLElement' is not assignable to type 'ReactNode' in React 18 #378

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

Open
na2793 opened this issue Apr 5, 2023 · 5 comments

Comments

@na2793
Copy link

na2793 commented Apr 5, 2023

https://codesandbox.io/s/young-frost-ujmz14?file=/src/index.tsx

I recently upgraded my project to React 18,
then the following error started to occur :

image

With React 17, there was no problem at all.

I think HTMLElement has changed to no longer be part of ReactNode.

I knew it was possible to pass id value in form of a string to scrollableTarget,
but I couldn't because the node I was trying to pass it to didn't have id.

What's the best way to handle this?

@na2793
Copy link
Author

na2793 commented Apr 6, 2023

image

The type of scrollableTarget does not have to be ReactNode, it needs to be HTMLElement.

The value of scrollableTarget is usually a DOM element obtained using useRef(), but useRef() cannot provide a ReactNode other than HTMLElement.

@bauerbach
Copy link

This library seems to have been abandoned unfortunately. :(

@ashwary23
Copy link

ashwary23 commented Jan 23, 2024

I upgraded from react 17 to react 18 and following issue started

'InfiniteScroll' cannot be used as a JSX component.
  Its instance type 'InfiniteScroll' is not a valid JSX element.
    The types returned by 'render()' are incompatible between these types.
      Type 'Element' is not assignable to type 'ReactNode'.

@PSoltes
Copy link

PSoltes commented Dec 11, 2024

its typescript issue only, which makes it even sadder that the library is abandoned, as this would be fixable very easily

@ankeetmaini
Copy link
Owner

ankeetmaini commented Dec 11, 2024 via email

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

5 participants