next-mdx-remote-client
Version:
A wrapper of the `@mdx-js/mdx` for the `nextjs` applications in order to load MDX content. It is a fork of `next-mdx-remote`.
20 lines • 690 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
import { hydrateAsync } from "./hydrateAsync.js";
/**
* it is experimental
*
* renders the content on the client side (csr), which is provided by the "hydrateAsync" function.
*
* the content is going to be hydrated "asynchronously" in a useEffect hook.
*/
export function MDXClientAsync(props) {
const { onError: ErrorComponent, ...rest } = props;
const { content, error } = hydrateAsync(rest);
/* v8 ignore next */
if (error && !ErrorComponent)
throw error;
if (error && ErrorComponent)
return _jsx(ErrorComponent, { error: error });
return content;
}
//# sourceMappingURL=MDXClientAsync.js.map