with-internals.tsx 578 字节
Newer Older
P
Peter Pan 已提交
1
/* eslint-disable @typescript-eslint/no-explicit-any */
2

3
import {NextI18NextInternals} from '../../types';
4
import React from 'react';
P
Peter Pan 已提交
5 6 7

export const withInternals = (WrappedComponent: any, config: NextI18NextInternals) => {
    class WithInternals extends React.Component {
8 9 10
        static displayName = `withNextI18NextInternals(${
            WrappedComponent.displayName || WrappedComponent.name || 'Component'
        })`;
P
Peter Pan 已提交
11 12 13 14 15 16 17 18

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

    return WithInternals;
};