react-simplemde-editor
react-simplemde-editor copied to clipboard
Preview not working (showing undefined)
When I click the preview button, the raw text is replaced by undefined
, instead of the compiled markdown.
import SimpleMdeReact from "react-simplemde-editor";
const component_name = () => {
const [value, setValue] = useState("");
const options = useMemo(() => {
return {
blockStyles: {
code: "```"
},
toolbar: [
"bold",
"italic",
"heading",
"|",
"code",
"quote",
"unordered-list",
"ordered-list",
"|",
"link",
"image",
"table",
"horizontal-rule",
"preview",
"guide"
],
}
}, []);
return (
<SimpleMdeReact value={value} options={options}/>
);
}
Versions:
"react": "^18.2.0",
"easymde": "^2.18.0",
"react-simplemde-editor": "^5.2.0",
same
Try easymde 2.16.0 or less
Try easymde 2.16.0 or less
Doesn't work for me
This worked for me. I had to set "easymde": "2.16.0"
in my package.json instead of "easymde": "^2.16.0"
. Note the missing carrot symbol to prevent npm from auto-upgrading it.
I saw this issue with easymed ^2.18.0. Downgrading to 2.16.0 fixes it for me.