How can I submit all of the typed data in MDEditor
in my react app ? I have tried the below way to submit, but i am not getting the whole types in data as string, could someone please advise me ?
import MDEditor from '@uiw/react-md-editor';
const [value, setValue] = React.useState("**Create a new blog**");
const handleChange = (value) => {
// Updating the state here...
setValue(value);
const fetchData = async (value) => {
try{
const res = await axios.post(`${appURL}/service/createBlog`, {value });
if (res.data.success) {
// do rest of the
}
else {
}
} catch (e){
console.log(e);
}
}
fetchData();
}
<div className='container'>
<MDEditor
className='reactEditorArea'
value={value}
onChange={handleChange}
/>
</div>
Your fetchData
has property value
but you call it without value
, fetchData()
.
To-BE
const handleChange = (value) => {
// ...
fetchData(value);
}