React-Quill is a robust React component that wraps the popular Quill rich-text editor, allowing developers to easily integrate a powerful WYSIWYG editing experience into their React applications. The current stable version is 2.0.0, which introduced a full TypeScript port, React 16+ compatibility, and a refactored build system, aiming for a drop-in upgrade for most users. While major releases, like v2, occur periodically with significant overhauls, the project generally maintains an active development pace with bug fixes and minor improvements. A key differentiator is its seamless integration with React's component lifecycle, abstracting away much of Quill's imperative API. It supports controlled mode with specific caveats, leveraging Quill's Delta format for content management and offering extensive customization options for toolbars and formats. It is designed to be highly extensible and performant within a React ecosystem, making it a go-to choice for rich-text editing needs.
npm install react-quillVerified import paths — ran on the pinned version, not inferred.
Demonstrates a basic controlled `ReactQuill` component using the 'snow' theme, managing editor content with React's `useState` hook.
Migrate usage to modern React patterns, remove references to `ReactQuill Mixin`, and implement custom toolbars using standard React components instead of the removed `Toolbar` component. Refer to the official v2 migration guide.
Ensure `value` updates are managed synchronously with `onChange` callbacks. Avoid asynchronous `value` updates that might conflict with Quill's internal state. For advanced control, consider using the `getEditor()` method to interact directly with the Quill instance and its Delta API.
Import the desired Quill theme CSS (e.g., `import 'react-quill/dist/quill.snow.css';`) in your application. Ensure your build system (e.g., Webpack) is configured to handle CSS imports correctly (e.g., using `style-loader` and `css-loader`).
Upgrade your project's `react` and `react-dom` packages to version 16, 17, or 18. If upgrading React is not feasible, consider using an older `react-quill` version compatible with your React setup.
Install `css-loader` and `style-loader` (or equivalent) via npm and configure your Webpack (or similar) setup to process `.css` files.
Ensure you are accessing the `getEditor()` method via a React ref to the `ReactQuill` component only after the component has mounted. Example: `const quillRef = useRef(null); // ... <ReactQuill ref={quillRef} ... /> // ... quillRef.current?.getEditor();`Always update the `value` prop synchronously within the `onChange` handler. If external state updates are needed, ensure they are merged carefully with the editor's current Delta state. For complex scenarios, consider using the `key` prop to force a re-render of the editor if external state requires a full reset.