A long requested feature is now available in Framer X Beta and Framer Web. Linking from code components can be done by adding a new property control: ControlType.EventHandler.
This allows you to see your events visually in the Framer UI (Prototyping Panel), and choose an action from there (Navigate, open URL, or log a message in the console)
You can find the documentation here and a small example of how it's used: https://www.framer.com/api/property-controls/#event-handler
We still have a few things to do before we launch this into stable Framer X, but feel free to use this if you're using Framer X Beta (https://framer.com/beta) or are already in the Framer Web Beta (https://framer.com/web)
Here's also a Framer Web Project you can explore to see how it's done! https://beta.framer.com/projects/Event-handlers-vVwxNI5TQvqAaeVkWAgV