Add a line widget onGutterClick

I’m trying to create an input widget for everytime a line number in the gutter is clicked. Presently, I’m able to pass the function addInputLineWidget onCursor change, and so every time the cursor on the editor switches to a new line, it fires the addInputLineWidget function. However that will be too inconvenient for users. And so I want the addInputLineWidget function to run only when the line numbers in the gutter are clicked, so that it pops up the input widget on the corresponding line as was clicked.

When i pass addInputLineWidget onGutterClick, I receive this error:

function addInputLineWidget:
Screenshot 2021-11-03 at 10.34.20

Codemirror Editor Wrapper:
Screenshot 2021-11-03 at 10.31.40

Codemirror Component:

react-codemirror version: 7.1.0,
Browser version: Google Chrome Version 94.0.4606.8
Operating system: macOS Big Sur v 11.5.2

Any help would be much appreciated.

Have you seen the CodeMirror Gutter Example?

Yes, i have. But I’m still not quite sure how to implement in React.