I am trying to add a template onClick, I am using ckeditor library and I want to get the instance of editor so that I can pass it and use the methods of it to the other components. But I've no idea how to do that, been searching it for a while but I cant put the right words on it. I am using functional component.
let ckeditor;
<CKEditorContext context={Context}>
<CKEditor
editor={ClassicEditor}
data={props.state.wysiwygData}
onChange={props.editorOnChangeHandler}
ref={props.editorRef}
onReady={(editor) => {
// I want to Pass the 'editor' instance to ckReference variable
ckReference = editor;
// But when I do this kind of approach it becomes undefined when passed
}}
/>
</CKEditorContext>
Thank you in advance and God bless