question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"React does not recognize the `blockKey` prop on a DOM element" error when using plugins

See original GitHub issue

Hello. When I create a plugin (I tried Linkify and Hashtag) and connect it to the Editor, everything seems fine, but the moment I insert for example a link into the editor, I get an error:

React does not recognize the blockKey prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase blockkey instead. If you accidentally passed it from a parent component, remove it from the DOM element.

The link in the editor is styled though - like a proper anchor tag: its color is blue, and it’s hoverable.

### My code: … import Editor from “draft-js-plugins-editor”; import createLinkifyPlugin from “draft-js-linkify-plugin”; import “draft-js-linkify-plugin/lib/plugin.css”; … const linkifyPlugin = createLinkifyPlugin(); const plugins = [linkifyPlugin]; … <div className="editor-wrapper" onClick={focusEditor}> <Editor ref={editor} editorState={editorState} onChange={newEditorState => setEditorState(newEditorState)} handleKeyCommand={handleKeyCommand} plugins={plugins} /> </div>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:8
  • Comments:9

github_iconTop GitHub Comments

4reactions
anders0lcommented, Jun 4, 2020

Hot fix for linkify plugin

import * as R from 'remeda'

...

    this.linkifyPlugin = createLinkifyPlugin({
      target: '_blank',
      component: (params: any) => <a {...R.omit(params, ['blockKey'])} />
    })

For omit you can use lodash, Object.assign() or whatever can clone object and remove prop.

4reactions
SirMojocommented, Sep 27, 2019

Hi,

i had the same problem today. The solution for me was to use older versions of the plugins. (Check for dependency warnings in the console when you install the plugins with npm/yarn)

The following versions work for me:

"draft-js": "^0.10.5",
"draft-js-linkify-plugin": "^2.0.2",
"draft-js-plugins-editor": "^2.1.1",
Read more comments on GitHub >

github_iconTop Results From Across the Web

React does not recognize the X prop on a DOM element ...
The problem is <div {...props}> in MyWrapper ; that adds the handleMoveAll prop onto the div. What you could do is something like:...
Read more >
Warning: React Does Not Recognize The Isfocused Prop On A ...
Ask questionsReact does not recognize the blockKey prop on a DOM element error when using plugins. Hello. When I create a plugin I...
Read more >
Warning: React does not recognize the isFocused prop on a ...
Coding example for the question Draft JS - mention- plugins produce this: Warning: React does not recognize the isFocused prop on a DOM...
Read more >
draft-js | Yarn - Package Manager
A React framework for building text editors. draftjs, editor, react, richtext ... Notable changes to Draft.js will be documented in this file.
Read more >
JavaScript tiny-warning Examples - HotExamples
warning( !(!this.props.location && prevProps.location), '<Switch> elements should not change from controlled to uncontrolled (or vice versa).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found