UNPKG

jsx-md

Version:

Generate markdown files with a React-like syntax.

26 lines 830 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.awaitComponent = void 0; /* @jsx MD */ const _1 = __importDefault(require(".")); /** * Wraps a function that returns a promise to be a valid component * @example * ```jsx * const AsyncText = awaitComponent(async ({ children }) => ( * <Text>{children}</Text> * )); * render(<AsyncText>Test</AsyncText>)) * === * `Hello` * ``` */ function awaitComponent(componentFn) { /* eslint-disable-next-line react/display-name */ return (props) => _1.default("mdAwait", null, componentFn(props)); } exports.awaitComponent = awaitComponent; //# sourceMappingURL=awaitComponent.js.map