From 304b4a0d66544551d75c96b281b75ad807fd41cb Mon Sep 17 00:00:00 2001 From: Alan Norbauer Date: Sun, 20 Oct 2019 15:50:05 -0700 Subject: [PATCH] Fix React warnings Fix instances of the React warning: ``` React.jsx: Spreading a key to JSX is a deprecated pattern. ' + 'Explicitly pass a key after spreading props in your JSX call. ' + 'E.g. ' ``` originating from https://github.com/facebook/react/blob/18d2e0c03e4496a824fdb7f89ea2a3d60c30d49a/packages/react/src/ReactElementValidator.js#L366-L373 This warning occurs when you spread a key with other props. There are probably more instances of this issue but these are the highest firing in our codebase. --- src/component/base/DraftEditor.react.js | 6 ++++-- src/component/contents/DraftEditorContents-core.react.js | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/component/base/DraftEditor.react.js b/src/component/base/DraftEditor.react.js index 4cf47fd078..8458da6d87 100644 --- a/src/component/base/DraftEditor.react.js +++ b/src/component/base/DraftEditor.react.js @@ -352,7 +352,6 @@ class DraftEditor extends React.Component { customStyleFn, editorKey: this._editorKey, editorState, - key: 'contents' + this.state.contentsKey, textDirectionality, }; @@ -420,7 +419,10 @@ class DraftEditor extends React.Component { all DraftEditorLeaf nodes so it's first in postorder traversal. */} - + diff --git a/src/component/contents/DraftEditorContents-core.react.js b/src/component/contents/DraftEditorContents-core.react.js index ae7d5eda53..e2f67b72ef 100644 --- a/src/component/contents/DraftEditorContents-core.react.js +++ b/src/component/contents/DraftEditorContents-core.react.js @@ -174,7 +174,6 @@ class DraftEditorContents extends React.Component { decorator, direction, forceSelection, - key, offsetKey, selection, tree: editorState.getBlockTree(key), @@ -225,7 +224,7 @@ class DraftEditorContents extends React.Component { const child = React.createElement( Element, childProps, - , + , ); processedBlocks.push({