withSSR.js 836 B

123456789101112131415161718192021222324252627
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.withSSR = void 0;
  6. var _react = require("react");
  7. var _useSSR = require("./useSSR.js");
  8. var _context = require("./context.js");
  9. var _utils = require("./utils.js");
  10. const withSSR = () => function Extend(WrappedComponent) {
  11. function I18nextWithSSR({
  12. initialI18nStore,
  13. initialLanguage,
  14. ...rest
  15. }) {
  16. (0, _useSSR.useSSR)(initialI18nStore, initialLanguage);
  17. return (0, _react.createElement)(WrappedComponent, {
  18. ...rest
  19. });
  20. }
  21. I18nextWithSSR.getInitialProps = (0, _context.composeInitialProps)(WrappedComponent);
  22. I18nextWithSSR.displayName = `withI18nextSSR(${(0, _utils.getDisplayName)(WrappedComponent)})`;
  23. I18nextWithSSR.WrappedComponent = WrappedComponent;
  24. return I18nextWithSSR;
  25. };
  26. exports.withSSR = withSSR;