diff --git a/addons/docs/src/frameworks/react/jsxDecorator.tsx b/addons/docs/src/frameworks/react/jsxDecorator.tsx index 57dee05a5189..3e1ef836a41b 100644 --- a/addons/docs/src/frameworks/react/jsxDecorator.tsx +++ b/addons/docs/src/frameworks/react/jsxDecorator.tsx @@ -115,12 +115,14 @@ export const renderJsx = (code: React.ReactElement, options: JSXOptions) => { // @ts-ignore FIXME: workaround react-element-to-jsx-string const child = typeof c === 'number' ? c.toString() : c; let string = applyBeforeRender(reactElementToJSXString(child, opts as Options), options); - const matches = string.match(/\S+=\\"([^"]*)\\"/g); - if (matches) { - matches.forEach((match) => { - string = string.replace(match, match.replace(/"/g, "'")); - }); + if (string.indexOf('"') > -1) { + const matches = string.match(/\S+=\\"([^"]*)\\"/g); + if (matches) { + matches.forEach((match) => { + string = string.replace(match, match.replace(/"/g, "'")); + }); + } } return string;