react-quill
react-quill copied to clipboard
Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.
i'm using react-quill with react-hooks .I got this warning
Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://reactjs.org/link/unsafe-component-lifecycles for details.
- Move data fetching code or side effects to componentDidUpdate.
- If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state
- Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run
npx react-codemod rename-unsafe-lifecyclesin your project source folder.
Please update the following components: Quill
here is my code
import React, { useState } from "react"; import ReactQuill from "react-quill"; import "react-quill/dist/quill.snow.css";
function TextEditor() { const [text, setText] = useState(""); const handleChange = value => setText(value);
return (
<ReactQuill value={text} onChange={handleChange} />
); } export default TextEditor;
same issue for me too.
Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run npx react-codemod rename-unsafe-lifecycles in your project source folder.
The author says it's fixed in the quillv2 beta. https://github.com/zenoamaro/react-quill/issues/564
In my case, the problem was happen because I'm trying to load a qr code inside the Storybook. So, I created a boolean state to identify when the scenario is a SB and apply a fake qr code (a generated image) and when it's in production, the real qr code will be called. Works great for me.
I'm using quillv2 beta and still have this problem
With the latest version (1.3.5), this appears to still be an issue.
With the latest version (1.3.5), this appears to still be an issue.
yes, I also faced this warning in stable version, use beta version