So I am trying to use react-mde as seen here https://github.com/andrerpena/react-mde
But I am getting the error "undefined is not a function" in my setup for some reason and I cannot figure out why.
import * as React from "react";
import ReactMde from "react-mde";
import ReactDOM from "react-dom";
import * as Showdown from "showdown";
import "react-mde/lib/styles/css/react-mde-all.css";
const converter = new Showdown.Converter({
tables: true,
simplifiedAutoLink: true,
strikethrough: true,
tasklists: true,
});
function NormEdit() {
const [value, setValue] = React.useState("**Hello world!!!**");
const [selectedTab, setSelectedTab] =
(React.useState < "write") | ("preview" > "write");
return (
<div className="container">
<ReactMde
value={value}
onChange={setValue}
selectedTab={selectedTab}
onTabChange={setSelectedTab}
generateMarkdownPreview={(markdown) =>
Promise.resolve(converter.makeHtml(markdown))
}
/>
</div>
);
}
export default NormEdit;
this is my code, and below is the line that the error is occuring on
const [selectedTab, setSelectedTab] =
(React.useState < "write") | ("preview" > "write");
any help would be much appreciated =]