react-codemirror icon indicating copy to clipboard operation
react-codemirror copied to clipboard

Uncaught TypeError: Cannot read property 'setOption' of undefined

Open IonutLaceanu opened this issue 9 years ago • 2 comments

Hi

I receive Uncaught TypeError: Cannot read property 'setOption' of undefined, which happens in componentWillReceiveProps at line 50. this.codeMirror.setOption(optionName, nextProps.options[optionName]);

For some reason, it seems that componentWillReceiveProps triggers before componentDidMount, so this.codeMirror is not yet defined.

The event also triggers after componentDidMount, though.

IonutLaceanu avatar Jan 27 '16 08:01 IonutLaceanu

I am also seeing this.

alechewitt avatar Mar 01 '16 06:03 alechewitt

If this issue still persists please give react-codemirror2 a look. I'm planning on maintaining this moving forward. Better docs will be coming. Feel free to open up any issues/suggestions as I'll be trying to gather as much constructive feedback from the community moving forward

scniro avatar Jun 02 '17 11:06 scniro