I'm working on a blog project with React.js
& Node.js
(express
& mongoose
) & react-quill library for editing my contents.
Right now I'm saving the contents from react-quill as string HTML to my react state.
...
const [content, setContent] = useState<string>('');
const onChange = (content: any, delta: any, source: any, editor: any) => {
setContent(editor.getHTML());
};
<ReactQuill
theme="snow"
value={content}
onChange={onChange}
modules={modules}
/>
...
After storing the HTML to my state as string, I send POST
request to my express application for storing this string in my MongoDB database.
The problem is that when I'm trying to fetch this HTML in my react app again (Inside one of the blog posts page) the contents are very large (Right now with 3 posts is 1MB).
My question is how can I keep the data at a lighter weight ?
Thank you.
EDIT : I didn't mentioned that I'm uploading images too using react-quill toolbar (Maybe thats the problem)