JedWatson / react-codemirror

Codemirror Component for React.js
MIT License
1.55k stars 262 forks source link

Uncaught TypeError: Cannot read property 'setOption' of undefined #32

Open IonutLaceanu opened 8 years ago

IonutLaceanu commented 8 years ago

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.

alechewitt commented 8 years ago

I am also seeing this.

scniro commented 7 years ago

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