version
- next: 12.0.7
- suneditor: 2.41.3
- suneditor-react: 3.3.1
const SunEditor = dynamic(() => import("suneditor-react"), {
ssr: false,
});
import "suneditor/dist/css/suneditor.min.css"; // Import Sun Editor's CSS File
// states
const [toggle, setToggle] = useState<boolean>(false);
const [content, setContent] = useState<string>("");
useState(() => {
console.log(toggle, content);
}, [toggle, content]);
// render
return (
<SunEditor
onChange={(content) => {
setToggle(!toggle);
setContent(!content);
}
/>
);
The console panel always show me that only content was changed, but toggle is not change.
I really don’t know what happen, I just want to set other states inside SunEditor onChange event, but I can’t. can anyone just explain it for me and how to fix this. Thank you.