Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getJSXSource(componentName: string, props: any) {
const _entries = entries(props);
let jsxProps = _entries.reduce(
(acc, entry) =>
(acc += `${entry[0]}={${
typeof entry[1] === "string" ? `"${entry[1]}"` : entry[1]
}} `),
""
);
return prettier.format(`<${componentName} ${jsxProps}>`, {
parser: "babylon",
plugins: [babylon]
});
}