Skip to content

Commit

Permalink
Do not mutate style object in render
Browse files Browse the repository at this point in the history
  • Loading branch information
valerybugakov committed Nov 11, 2017
1 parent 4ba7c34 commit ca5ea0c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/CodeSlide.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,10 @@ class CodeSlide extends React.Component {
const loc = range.loc || [];
const slideBg = bgColor || defaultBgColor;

style.color = color || style.color;
const newStyle = {
...style,
color: color || style.color,
};

const lines = getHighlightedCodeLines(code, lang).map((line, index) => {
return <div
Expand All @@ -213,7 +216,7 @@ class CodeSlide extends React.Component {
<Slide ref='slide' bgColor={slideBg} margin={1} {...rest}>
{range.title && <CodeSlideTitle>{range.title}</CodeSlideTitle>}

<pre ref="container" style={style}>
<pre ref="container" style={newStyle}>
<code style={{ display: "inline-block", textAlign: "left" }}>{lines}</code>
</pre>

Expand Down

0 comments on commit ca5ea0c

Please sign in to comment.