Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cooljl31/d1bb2288858178ff96ec283d7e4468c6 to your computer and use it in GitHub Desktop.
Save cooljl31/d1bb2288858178ff96ec283d7e4468c6 to your computer and use it in GitHub Desktop.
How to use React Quill inside Redux Forms
import React from 'react';
import { Field } from 'redux-form';
import ReactQuill from 'react-quill';
function renderQuill({ input }) {
return (
<ReactQuill
{...input}
onChange={(newValue, delta, source) => {
if (source === 'user') {
input.onChange(newValue);
}
}}
onBlur={(range, source, quill) => {
input.onBlur(quill.getHTML());
}}
/>
);
}
// Usage:
<Field name="description" component={renderQuill} />;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment