How to get the code inside codemirror on Onblur Operation

442 views Asked by At

I can get the data in textArea from onChange operation, but that is costing me too much state rendering causing my area to get out of focus.

I want to get the textWritten in codeArea on Onblur event. OnBlur event is returning only DOMEvent.

How can I get the code inside textArea in react on onBlur Event trigger?

1

There are 1 answers

0
Abhishek Kumar On
// function
 function saveCodeEditorChanges(data) {
    console.log(data.valueOf().getValue())
  }


// component
            <CodeMirror
              value={yaml}
              options={{
                theme: "material",
              }}
              onBlur={(a) => saveCodeEditorChanges(a)}
            />

The datacan be fetched this way on OnBlur Operations