Skip to content

Commit 529694f

Browse files
sofiapohsatya164
authored andcommitted
fix: SSR mismatch caused by CSS text (react-simple-code-editor#21)
Fixes a mismatch on SSR caused by setting `style` content as plain string instead of using `dangerouslySetInnerHTML`
1 parent 6292a46 commit 529694f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,8 @@ export default class Editor extends React.Component<Props, State> {
556556
? { dangerouslySetInnerHTML: { __html: highlighted + '<br />' } }
557557
: { children: highlighted })}
558558
/>
559-
<style type="text/css">{cssText}</style>
559+
{/* eslint-disable-next-line react/no-danger*/}
560+
<style type="text/css" dangerouslySetInnerHTML={{ __html: cssText }} />
560561
</div>
561562
);
562563
}

0 commit comments

Comments
 (0)