My code is almost same like the example.
import React from 'react';
import MarkdownIt from 'markdown-it'
import MdEditor from 'react-markdown-editor-lite'
// import style manually
import 'react-markdown-editor-lite/lib/index.css';
const CreatePost = () => {
const mdParser = new MarkdownIt(/* Markdown-it options */);
const handleEditorChange = ({ html, text }) => {
console.log('handleEditorChange', html, text)
}
return (
<div>
<MdEditor
value=""
renderHTML={(text) => mdParser.render(text)}
onChange={handleEditorChange}
/>
</div>
);
}
export default CreatePost;