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`.
19 lines • 640 B
JavaScript
import { jsx as _jsx } from "react/jsx-runtime";
/**
* Copyright (c) @talatkuyuk AKA @ipikuka
* SPDX-License-Identifier: MPL-2.0
*/
import { evaluate } from "./evaluate.js";
/**
* renders the content as a react server component (rsc), which is provided by the "evaluate" function
*/
export async function MDXRemote(props) {
const { onError: ErrorComponent, ...rest } = props;
const { content, error } = await evaluate(rest);
if (error && !ErrorComponent)
throw error;
if (error && ErrorComponent)
return _jsx(ErrorComponent, { error: error });
return content;
}
//# sourceMappingURL=MDXRemote.js.map