Side toolbar error: Uncaught TypeError: _this.props.store.getItem(...) is not a function
See original GitHub issueToolbar isn’t loading. And I get this error every keypress.
Error:
Uncaught TypeError: _this.props.store.getItem(...) is not a function
This is my source code:
import React, { Component } from 'react';
import Editor, { createEditorStateWithText } from 'draft-js-plugins-editor'; // eslint-disable-line import/no-unresolved
import createSideToolbarPlugin from 'draft-js-side-toolbar-plugin'; // eslint-disable-line import/no-unresolved
import 'draft-js-inline-toolbar-plugin/lib/plugin.css';
import 'draft-js-side-toolbar-plugin/lib/plugin.css';
// Sidebar toolbar
const sideToolbarPlugin = createSideToolbarPlugin();
const { SideToolbar } = sideToolbarPlugin;
// Plugins
const plugins = [
sideToolbarPlugin,
];
const text = 'In this editor a toolbar shows up once you select part of the text …';
export default class CardEditor extends Component {
state = {
editorState: createEditorStateWithText(text),
};
onChange = (editorState) => {
this.setState({
editorState,
});
};
focus = () => {
this.editor.focus();
};
render() {
return (
<div onClick={this.focus}>
<Editor
editorState={this.state.editorState}
onChange={this.onChange}
plugins={plugins}
ref={(element) => { this.editor = element; }}
/>
<SideToolbar />
</div>
);
}
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:12
Top Results From Across the Web
A brand new website interface for an even better experience!
Side toolbar error : Uncaught TypeError: _this.props.store.getItem(...) is not a function.
Read more >TypeError: getItem is not a function when testing a component ...
The test breaks at "productInCart = getItem(product.id)" saying " TypeError: getItem is not a function". I've been stuck at this for several ...
Read more >Getting Data Out of the Redux Store with Selectors
A selector is a pure function that takes a state object from the Redux store and returns some information extracted from that state...
Read more >"TypeError: _this.props.registeruser is not a function" : r/reactjs
The child component, PlayerRegistration, is where the problem resides. "componentDidMount()" shows the prop received is an empty object? huh?!?
Read more >TypeError: is not a function in react Code Example
jQuery(document).ready(function($){ // jQuery code is in here }); ... Uncaught TypeError is not a function JavaScript. javascript by Attractive Anteater on ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Even i am facing the same issue!
I found the error. I had code where I would call
createSideToolbarPlugin()
inside therender()
function of my component. This means a new plugin would be crated all the time. Movingconst sideToolbarPlugin = createSideToolbarPlugin();
to the global scope solved this.