TransText.js 635 B

12345678910111213141516
  1. "use strict";
  2. var __importDefault = (this && this.__importDefault) || function (mod) {
  3. return (mod && mod.__esModule) ? mod : { "default": mod };
  4. };
  5. Object.defineProperty(exports, "__esModule", { value: true });
  6. var react_1 = require("react");
  7. var formatElements_1 = __importDefault(require("./formatElements"));
  8. function TransText(_a) {
  9. var text = _a.text, components = _a.components;
  10. return (0, react_1.useMemo)(function () {
  11. return !components || components.length === 0
  12. ? text
  13. : (0, formatElements_1.default)(text, components);
  14. }, [text, components]);
  15. }
  16. exports.default = TransText;