CKEditor error: Attempted import error: 'ckeditor4-react' does not contain a default export (imported as 'CKEditor')

Viewed 313

I am trying to use the CKEditor in my react app. I don't know why this error is occurring.

This is how I've imported the CKEditor:

import CKEditor from 'ckeditor4-react';

This is how I've used it:

<CKEditor 
    onChange={evt => console.log( evt )}
/>

This is the error I keep getting:

Attempted import error: 'ckeditor4-react' does not contain a default export (imported as 'CKEditor').

2 Answers

you should write import {CKEditor} from 'ckeditor4-react'; because of default export you should use {}

In case anyone else is having this issue - for us it was because with ckeditor4-react < 2.0.0, there was no native TypeScript support, so we introduced our own index.d.ts types file. After upgrading however, our file was no longer compatible. We simply removed our index.d.ts types file, updated some of the props (e.g. we were using data instead of initData) and everything worked after that.

Related