react icon indicating copy to clipboard operation
react copied to clipboard

Forward Link component's ref.

Open abdullaev388 opened this issue 2 years ago • 2 comments

https://github.com/atomic-router/react/blob/d2c936dea41b50ad933afb7eeab2f2aba0e42bf9/src/link.tsx?rgh-link-date=2022-09-08T13%3A55%3A34Z#L17

Some ui frameworks require components to forward ref, otherwise react will throw an error: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

abdullaev388 avatar Sep 08 '22 13:09 abdullaev388

@abdullaev388 What is the case you need ref for the link?

sergeysova avatar Sep 08 '22 14:09 sergeysova

@abdullaev388 What is the case you need ref for the link?

I use rsuite ui library and it has Nav.Item component of navbar: https://rsuitejs.com/guide/composition/#react-router-dom

This component has "as" prop. This prop takes another component which will handle navigation. So if i pass Link as an argument to this prop, i receive an error from react.

abdullaev388 avatar Sep 08 '22 15:09 abdullaev388

Added

abdullaev388 avatar Oct 12 '23 07:10 abdullaev388