Skip to content

Commit

Permalink
Should not mutate initial styles
Browse files Browse the repository at this point in the history
Current code is mutating initial state thus affecting other instance of `<Markdown>` with `styles` prop.
  • Loading branch information
lodev09 authored Apr 29, 2017
1 parent c026036 commit 5ef42e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Markdown extends PureComponent<DefaultProps, Props, void> {

_renderContent = (children: string): React$Element<any> => {
try {
const mergedStyles = Object.assign(initialStyles, this.props.styles)
const mergedStyles = Object.assign({}, initialStyles, this.props.styles)
const rules = this._postProcessRules(_.merge({}, SimpleMarkdown.defaultRules, initialRules(mergedStyles), this.props.rules))
const child = Array.isArray(this.props.children)
? this.props.children.join('')
Expand Down

0 comments on commit 5ef42e1

Please sign in to comment.