ericclemmons / click-to-component

Option+Click React components in your browser to instantly open the source in VS Code
MIT License
1.84k stars 70 forks source link

Add support for a custom onClick for ClickToComponent #28

Open frantic opened 2 years ago

frantic commented 2 years ago

Is your feature request related to a problem? Please describe.

  1. Support click-to-component in web environments like Replit
  2. Add custom logic to run before editor is opened

Describe the solution you'd like

Make <ClickToComponent /> accept an onClick callback that would get the element, component, file path, etc. as arguments.

Describe alternatives you've considered

Intercepting navigation events or patching window.open: both seem fragile and miss information about the target HTMLElement.