primereact icon indicating copy to clipboard operation
primereact copied to clipboard

Hook: useScrollTop target prop

Open ibodev1 opened this issue 3 months ago • 1 comments

Hello, I believe that the useScrollTop hook's target parameter supporting React ref in version v11 would be much more suitable for React's architecture.

React ref type: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/ac1acf965f539e4a9f7ac38bd268675793ded4c1/types/react/index.d.ts#L193

prop: https://github.com/primefaces/primereact/blob/5e06098603bed22fff841138f90bfe2b6b8fcbbb/packages/hooks/src/use-scrolltop/index.ts#L12

I think it would be more logical to use useref instead of target usestate in the hook's documentation to pass it to the target parameter.

#8253

ibodev1 avatar Oct 08 '25 08:10 ibodev1

Additionally, supporting the primary React input text type when the usemask hook references the target could be more useful and type-safe. Forcing developers to use an extra useEffect to use the usemask hook with the input text component and forcing them to retrieve the target element from the input reference makes the code difficult to read and use. I believe it would be much more useful if the useMask hook supported native HTML input element types while also supporting Primereact input types by default.

https://v11.primereact.org/docs/hooks/usemask #8223

ibodev1 avatar Oct 08 '25 08:10 ibodev1