I am encountering a compatibility issue with the react-scroll-to-top package when using it in conjunction with Next.js server components. The error message suggests a problem related to the use of useState in server components.
Steps to Reproduce:
Include react-scroll-to-top in a Next.js project with server components.
Attempt to use the useState hook provided by the react-scroll-to-top package in a server component.
Observe the error: "⨯ useState only works in Client Components. Add the 'use client' directive at the top of the file to use it."
Expected Behavior:
The react-scroll-to-top package should work seamlessly with Next.js server components, and the useState hook should function as expected.
Additional Information:
Next.js version: 14.0.4
react-scroll-to-top version:3.0.0
Please let me know if there are any suggested workarounds or if there is an estimated timeline for resolving this compatibility issue.
Issue Description:
I am encountering a compatibility issue with the
react-scroll-to-top
package when using it in conjunction with Next.js server components. The error message suggests a problem related to the use ofuseState
in server components.Steps to Reproduce:
react-scroll-to-top
in a Next.js project with server components.useState
hook provided by thereact-scroll-to-top
package in a server component.Expected Behavior:
The
react-scroll-to-top
package should work seamlessly with Next.js server components, and theuseState
hook should function as expected.Additional Information:
react-scroll-to-top
version:3.0.0Please let me know if there are any suggested workarounds or if there is an estimated timeline for resolving this compatibility issue.
Thank you for your attention to this matter.