with-internals.tsx 576 字节
Newer Older
P
Peter Pan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
/* eslint-disable @typescript-eslint/no-explicit-any */
import React from 'react';
import {NextI18NextInternals} from '../types';

export const withInternals = (WrappedComponent: any, config: NextI18NextInternals) => {
    class WithInternals extends React.Component {
        static displayName = `withnextI18NextInternals(${WrappedComponent.displayName ||
            WrappedComponent.name ||
            'Component'})`;

        render() {
            return <WrappedComponent {...this.props} nextI18NextInternals={config} />;
        }
    }

    return WithInternals;
};