import SimpleMdeReact, { SimpleMdeToCodemirrorEvents } from "../SimpleMdeReact"; import { useMemo, useState } from "react"; import SimpleMDE from "easymde"; import React from "react"; let counter = 1; export const State = (props: any) => { return (
{JSON.stringify(props, null, 2)}
); }; const events = { focus: () => console.log("focus"), } as SimpleMdeToCodemirrorEvents; export const UpdateUsingButtonWithAutofocus = () => { const [value, setValue] = useState( "I am the initial value. Erase me, or try the button above." ); const onChange = (value: string) => { setValue(value); }; const handleTextChangeByButton = () => { setValue(`Changing text by setting new state. ${counter++}`); }; const autofocusNoSpellcheckerOptions = useMemo(() => { return { autofocus: true, spellChecker: false, } as SimpleMDE.Options; }, []); return (

Autofocus spellchecker disabled, button updated, controlled

Update by button

); };