You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
703 B
23 lines
703 B
import { createElement } from 'react';
|
|
import { useSSR } from './useSSR';
|
|
import { composeInitialProps } from './context';
|
|
import { getDisplayName } from './utils';
|
|
|
|
export function withSSR() {
|
|
return function Extend(WrappedComponent) {
|
|
function I18nextWithSSR({ initialI18nStore, initialLanguage, ...rest }) {
|
|
useSSR(initialI18nStore, initialLanguage);
|
|
|
|
return createElement(WrappedComponent, {
|
|
...rest,
|
|
});
|
|
}
|
|
|
|
I18nextWithSSR.getInitialProps = composeInitialProps(WrappedComponent);
|
|
I18nextWithSSR.displayName = `withI18nextSSR(${getDisplayName(WrappedComponent)})`;
|
|
I18nextWithSSR.WrappedComponent = WrappedComponent;
|
|
|
|
return I18nextWithSSR;
|
|
};
|
|
}
|