<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Adeel Raza on Medium]]></title>
        <description><![CDATA[Stories by Adeel Raza on Medium]]></description>
        <link>https://medium.com/@adeelraza?source=rss-126906d3fa82------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*-LZP5Dj6KUc-F_NN.jpg</url>
            <title>Stories by Adeel Raza on Medium</title>
            <link>https://medium.com/@adeelraza?source=rss-126906d3fa82------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 14 Nov 2026 03:16:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adeelraza/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Creating a Drag-n-Drop Email Editor with React]]></title>
            <link>https://medium.com/unlayer-blog/creating-a-drag-n-drop-email-editor-with-react-db1e9eb42386?source=rss-126906d3fa82------2</link>
            <guid isPermaLink="false">https://medium.com/p/db1e9eb42386</guid>
            <category><![CDATA[react-components]]></category>
            <category><![CDATA[email-marketing]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Adeel Raza]]></dc:creator>
            <pubDate>Thu, 05 Oct 2017 07:13:08 GMT</pubDate>
            <atom:updated>2017-10-31T18:28:33.275Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*tAW1LhMa8Q5jHhfmnQ7AfQ.png" /></figure><h3>Introduction</h3><p>Every time we wanted to add a drag-n-drop email editor in any of our projects, there weren’t many good options available that were polished and reliable enough for commercial use. After months of search, we decided to build one that can be embedded in any web app within 5 minutes. It’s available on <a href="https://github.com/unlayer/react-email-editor">GitHub</a> and <a href="https://www.npmjs.com/package/react-email-editor">NPM</a>.</p><p>Here’s what it looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W6RHFFNLqAeb01qnP7mwBw.jpeg" /><figcaption>Unlayer’s Drag-n-Drop Editor</figcaption></figure><p>It takes care of all the unsexy and boring stuff that comes with building a reliable and solid email / page builder. Things like outputting the correct HTML syntax, and making sure it looks and works fine in all old browsers and email clients (Hi, IE &amp; Outlook =).</p><h3>Getting Started</h3><h4>Installation</h4><p>The easiest way to use it is to install it from NPM.</p><pre>npm install react-email-editor --save</pre><h4>Usage</h4><p>We will first import the editor in our React component.</p><pre>import EmailEditor from &#39;react-email-editor&#39;</pre><p>Next, we’ll render the email editor in our React app.</p><pre>class App extends Component {<br>  render() {<br>    return &lt;div&gt;<br>      &lt;EmailEditor<br>        ref={editor =&gt; this.editor = editor}<br>      /&gt;<br>    &lt;/div&gt;<br>  }<br>}</pre><p>That’s it. This should render a fully functional drag-n-drop editor in your React app. The EmailEditor component accepts the following props.</p><ul><li>style Object — style object for the editor container (default {})</li><li>minHeight String — minimum height to initialize the editor with (default 500px)</li><li>onLoad Function — called when the editor has finished loading</li><li>options Object — options passed to the Unlayer editor instance (default {})</li></ul><h4><strong>Exporting HTML</strong></h4><p>Now that we have a fully functional email editor, we need to save the HTML it outputs. The editor exposes a method called <strong>exportHtml </strong>that converts the user design into HTML.</p><p>Here’s how that is done…</p><pre>class App extends Component {<br>  render() {<br>    return &lt;div&gt;<br>      &lt;button onClick={this.exportHtml}&gt;Export HTML&lt;/button&gt;<br><br>      &lt;EmailEditor<br>        ref={editor =&gt; this.editor = editor}<br>      /&gt;<br>    &lt;/div&gt;<br>  }<br><br>  exportHtml = () =&gt; {<br>    this.editor.exportHtml(data =&gt; {<br>      const { design, html } = data<br>      console.log(&#39;exportHtml&#39;, html)<br>    })<br>  }<br>}</pre><h4>Saving Designs</h4><p>While HTML is the final result of the design, you will need to save the work done in the email editor for future use. There are a number of use cases for this such as:</p><ul><li>Having pre-designed templates</li><li>Saving drafts and resuming work later</li></ul><p>Our email editor saves all work in JSON format. You can save the JSON and then pass it when loading the editor again and it will resume from where you left.</p><p>Here’s how to do that…</p><pre>class App extends Component {<br>  render() {<br>    return &lt;div&gt;<br>      &lt;button onClick={this.saveDesign}&gt;Save Design&lt;/button&gt;<br><br>      &lt;EmailEditor<br>        ref={editor =&gt; this.editor = editor}<br>      /&gt;<br>    &lt;/div&gt;<br>  }<br><br>  saveDesign = () =&gt; {<br>    this.editor.saveDesign(design =&gt; {<br>      console.log(&#39;saveDesign&#39;, design)<br>    })<br>  }<br>}</pre><h4>Loading Designs</h4><p>Once you have the JSON saved, you can pass it to the editor using the <strong>loadDesign </strong>method.</p><pre>class App extends Component {<br>  render() {<br>    return &lt;div&gt;<br>      &lt;button onClick={this.saveDesign}&gt;Save Design&lt;/button&gt;<br><br>      &lt;EmailEditor<br>        ref={editor =&gt; this.editor = editor}<br>        onLoad={this.onLoad}<br>      /&gt;<br>    &lt;/div&gt;<br>  }<br><br>  onLoad = () =&gt; {<br>    const json = /* DESIGN JSON GOES HERE */<br>    this.editor.loadDesign(json)<br>  }<br>}</pre><p>We hope you use this free React component to build powerful email editing applications.</p><h3>More Resources</h3><h4>Full Documentation</h4><p>You can check out Unlayer’s <a href="https://docs.unlayer.com/">full documentation</a> for all available options.</p><h4>Live Demo</h4><p>Check out the live demo here: <a href="http://react-email-editor-demo.netlify.com/">http://react-email-editor-demo.netlify.com/</a></p><h4>Example Source</h4><p>See the <a href="https://github.com/unlayer/react-email-editor/blob/master/demo/src/index.js">example source</a> for a reference implementation.</p><h4>Real World Applications</h4><p>You can check out EmailMonster’s <a href="https://emailmonster.io/">email editor</a> or <a href="https://www.mailmunch.co/">MailMunch</a>’s email editor and <a href="https://www.mailmunch.co/landing-pages/">landing page</a> builder for a full demo.</p><h4>Explainer Video</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMIWhX-NF3j8%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMIWhX-NF3j8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMIWhX-NF3j8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3859bcb772200a5fefc16e67b140fdd6/href">https://medium.com/media/3859bcb772200a5fefc16e67b140fdd6/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db1e9eb42386" width="1" height="1" alt=""><hr><p><a href="https://medium.com/unlayer-blog/creating-a-drag-n-drop-email-editor-with-react-db1e9eb42386">Creating a Drag-n-Drop Email Editor with React</a> was originally published in <a href="https://medium.com/unlayer-blog">Unlayer Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>