react
react copied to clipboard
Forward Link component's ref.
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 What is the case you need ref
for the link?
@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.