From 5ef42e1fcaa42c8d6328ce13591e8a7d45c886be Mon Sep 17 00:00:00 2001 From: Jovanni Lo Date: Sun, 30 Apr 2017 03:36:46 +0800 Subject: [PATCH] Should not mutate initial styles Current code is mutating initial state thus affecting other instance of `` with `styles` prop. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 83fdf08..da1cf4e 100644 --- a/index.js +++ b/index.js @@ -46,7 +46,7 @@ class Markdown extends PureComponent { _renderContent = (children: string): React$Element => { 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('')