You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The withLocalization HOC is unable to forward refs to the wrapped component.
This would be useful for legacy projects that rely on class-based React components. The withLocalization HOC is the best option to provide the getString interface, but if the wrapped component relies on a ref being applied, withLocalization won't work.
There is an easy workaround, which is for developers to roll their own HOC that forwards a ref, composed from useLocalization. It may be a good feature to add to the official fluent react bindings.
Yeah, that makes sense. Would you be willing/interested in submitting a PR for that, probably by adding an optional second arg like { forwardRef?: boolean } to withLocalization()?
The
withLocalization
HOC is unable to forward refs to the wrapped component.This would be useful for legacy projects that rely on class-based React components. The
withLocalization
HOC is the best option to provide thegetString
interface, but if the wrapped component relies on a ref being applied,withLocalization
won't work.There is an easy workaround, which is for developers to roll their own HOC that forwards a ref, composed from
useLocalization
. It may be a good feature to add to the official fluent react bindings.i18next has a similar HOC, but supports an option to forward a ref through to the wrapped component: https://react.i18next.com/latest/withtranslation-hoc#use-ref-greater-than-v10.6.0
The text was updated successfully, but these errors were encountered: