react-rte
react-rte copied to clipboard
Mixed up default and named imports
Hi,
I am currently trying to use server side rendering in a rails project with react-rte
and I am hitting this issue:
If I import RichTextEditor from 'react-rte/lib/RichTextEditor';
, Rails is throwing me this error:
Invariant Violation: Element type is invalid: expected a string
(for built-in components) or a class/function (for composite components)
but got: undefined. You likely forgot to export your component from the
file it's defined in, or you might have mixed up default and named imports
It's same if I simply import import RichTextEditor from 'react-rte
.
Do you have any idea of the why?
I see that in the react-rte/lib/RichTextEditor.js
. You have this code:
export default RichTextEditor;
// $FlowIssue - This should probably not be done this way.
_Object$assign(RichTextEditor, {
...
});
export { EditorValue, decorator, createEmptyValue, createValueFromString, ButtonGroup, Button, Dropdown };
Is this comment a hint or not? We clearly can see that we are mixing default and named exports here as well. Is there a way to fix this?
Hi I am getting this same issue trying use Next.js. Is there a fix for this?
Sorry, I can't remember :/