我对此感到困惑。我找不到解决方案。
返回错误:
./src/components/TextEditor.js 尝试导入错误:“slate-react”不包含默认导出(导入为“编辑器”)。
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} />
)
}
}
指数
import TextEditor from './TextEditor';
export { TextEditor };