Save and Load Rich Text Editor Content in React and Next.js (2026)
Save what your users write in Eddyter to your own database, load it back with initialContent, and show it on your site with ContentPreview. Six steps, about two minutes.
Your editor is only useful if the writing sticks. This tutorial shows how to save rich text editor content from Eddyter to your own database, load it back into the editor, and show it on your site. Eddyter gives you the document as one HTML string, so it fits any stack.
What you will learn
- What you get: every time the content changes,
onChangereceives the whole document as HTML, with formatting, tables and images inside. - Keep it in state: create a
contentstate and passsetContenttoonChange, so your component always has the latest HTML. - Save it: on Save, send the HTML to an API route and write it to a text column. Postgres, MySQL, MongoDB or your CMS all work.
- Load it back: fetch the saved HTML and pass it to
initialContent. The editor reads it once, when it mounts, so render the editor after the data arrives and give itkey={post.id}so each post loads its own content. - Show it on your site: render saved HTML with
<ContentPreview content={post.content} />insideEditorProvider, or set the editor tomode="preview"and switch back to edit on click. - Good habits: save on a short debounce, keep email HTML separate (it is for sending, not for loading back), and sanitize public HTML before rendering.
Before you start
You need Eddyter installed in your app (see the Next.js setup tutorial). For named snapshots, see version history. Full reference in the Eddyter docs and the code on GitHub. Watch it on YouTube.
Show the full transcriptHide the transcript
Your editor is only useful if the writing sticks. In this video, you'll save what your users write in Eddyter to your own database, load it back, and show it on your site. Six steps, about two minutes. Every time the content changes, Eddyter calls onChange, with the document as HTML. One string, with all the formatting, tables and images inside. That's what you store. Keep it in state: create a content state, and pass setContent to onChange. Now your component always has the latest HTML. When the user clicks Save, send that HTML to your API, and write it to a text column in your database. Any database works: Postgres, MySQL, MongoDB, or your CMS. To edit it later, fetch the saved HTML, and pass it to initialContent. The editor reads it once, when it mounts. So render the editor after the data arrives, and give it a key, so switching posts loads the right one. To show it to readers, use ContentPreview with the saved HTML. Or set the editor's mode to preview, and switch back to edit on click. Three good habits. Save on a short debounce, not on every keystroke. Keep email HTML separate: it's for sending, not for loading back. And if the content is public, treat it like any user HTML, and sanitize it before rendering. That's it: onChange to state, save the HTML, load it with initialContent, and show it with ContentPreview. The code is on GitHub, and everything else is at eddyter.com.
How do I get content out of the Eddyter editor?
Pass a handler to onChange. Every time the content changes, it receives the whole document as one HTML string, which you can keep in state and save.
What format does Eddyter save content in?
HTML. onChange gives you a single HTML string with the formatting, tables and images inside, so you can store it in a text column in any database.
How do I load saved content back into the editor?
Pass the saved HTML to initialContent. The editor reads it once, when it mounts, so render the editor after your data has loaded and set key={post.id} so switching posts loads the right content.
How do I show saved content on my website?
Use ContentPreview with the saved HTML inside EditorProvider, or render the editor with mode="preview" and switch to edit mode on click.
Can I load email HTML back into the editor?
No. Email output is for sending. The editor will not load exported email HTML as initialContent, so store document and email HTML separately and check meta.mode in onChange.
6:35IntegrationVideo guideAdd a Rich Text Editor to Your Blog in 10 Minutes (React & Next.js, 2026)Publish a blog post with a plain textarea, then republish the same post with a real editor. Formatting survives, images align, and the AI generates a header image without leaving the page. React, Next.js, Vue and Angular — about 10 minutes of setup.