Skip to content

Commit 4cdf160

Browse files
authored
Update README.md
1 parent 7533bf4 commit 4cdf160

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ import "easymde/dist/easymde.min.css";
8686
export const ControlledUsage = () => {
8787
const [value, setValue] = useState("Initial value");
8888

89-
const onChange = (value: string) => {
89+
const onChange = useCallback((value: string) => {
9090
setValue(value);
91-
};
91+
}, []);
9292

9393
return <SimpleMdeReact value={value} onChange={onChange} />;
9494
};
@@ -112,9 +112,9 @@ Slightly more on that here: [#164](https://github.com/RIP21/react-simplemde-edit
112112
export const UsingOptions = () => {
113113
const [value, setValue] = useState("Initial");
114114

115-
const onChange = (value: string) => {
115+
const onChange = useCallback((value: string) => {
116116
setValue(value);
117-
};
117+
}, []);
118118

119119
const autofocusNoSpellcheckerOptions = useMemo(() => {
120120
return {
@@ -202,9 +202,9 @@ import type { SimpleMdeToCodemirrorEvents } from "react-simplemde-editor";
202202
export const CustomEventListeners = () => {
203203
const [value, setValue] = useState("Initial value");
204204

205-
const onChange = (value: string) => {
205+
const onChange = useCallback((value: string) => {
206206
setValue(value);
207-
};
207+
}, []);
208208

209209
// Make sure to always `useMemo` all the `options` and `events` props to ensure best performance!
210210
const events = useMemo(() => {

0 commit comments

Comments
 (0)