with-internals.tsx 656 字节
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

P
Peter Pan 已提交
6
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
P
Peter Pan 已提交
7 8
export const withInternals = (WrappedComponent: any, config: NextI18NextInternals) => {
    class WithInternals extends React.Component {
9 10 11
        static displayName = `withNextI18NextInternals(${
            WrappedComponent.displayName || WrappedComponent.name || 'Component'
        })`;
P
Peter Pan 已提交
12 13 14 15 16 17 18 19

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

    return WithInternals;
};