Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 4x 6x 6x | import React, { ComponentClass } from "react"; import { useTranslation } from "./translation"; export function withTranslation<C extends ComponentClass<any>>( WrappedComponent: C ): C { return (React.forwardRef( (props, ref: React.LegacyRef<React.Component<any>>) => { const t = useTranslation(); return React.createElement(WrappedComponent, { ...props, ref, t }); } ) as any) as C; } |