I am confused by this. I couldn't find a solution.
Returns an error:
./src/components/TextEditor.js Attempted import error: 'slate-react' does not contain a default export (imported as 'Editor').
import React, { Component } from 'react'
import Editor from 'slate-react'
import Value from 'slate'
const initialValue = Value.fromJSON({
document: {
nodes: [
{
object: 'block',
type: 'paragraph',
nodes: [
{
object: 'text',
leaves: [
{
text: 'A line of text in a paragraph.',
},
],
}, ],
}, ],
},
})
export default class TextEditor extends Component {
state = {
value: initialValue,
}
onChange = ({ value }) => {
this.setState({ value })
}
render() {
return (
<Editor value={this.state.value} onChange={this.onChange} />
)
}
}
index
import TextEditor from './TextEditor';
export { TextEditor };