How to pass state information from parent component to CodeMirror ?

I use CodeMirror in my react component. I have a use case where I need to pass state information from the parent component to CodeMirror Editor, and the editor needs to change based on the state information. How do I pass state information to the CodeMirror Editor ?

Also how do I keep track of state information (for example if the dialog is open or close etc) within CodeMirror, so that the next event gets the latest value ?

I am doing this in Vue by passing in the state object to specific extensions that need this parent context.

May be there is a more generic way to append the parent’s context to the state of an editor as it is being created. I haven’t tested that.

You generally define a state field to hold your extra state, set up its update method to check for state effects you define for the purpose, and fire transactions with such effects to update it.

@crossvalidator & @marijn, Thanks for your reply. I will try that.