
Security News
NVD Quietly Sweeps 100K+ CVEs Into a “Deferred” Black Hole
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
click-to-react-component
Advanced tools
Option+Click your React components in your browser to open the source file in VS Code
Option+Click a Component in the browser to instantly goto the source in your editor.
Option+Click opens the immediate Component's source
Option+Right-click opens a context menu with the parent Components' props
, fileName
, columnNumber
, and lineNumber
Works with frameworks like Next.js, Create React App, & Vite that use @babel/plugin-transform-react-jsx-source
Supports vscode
& vscode-insiders
& cursor
URL handling
Automatically tree-shaken from production
builds
Keyboard navigation in context menu (e.g. ←, →, ⏎)
More context & faster than using React DevTools:
npm install click-to-react-component
pnpm add click-to-react-component
yarn add click-to-react-component
Even though click-to-react-component
is added to dependencies
, tree-shaking will remove click-to-react-component
from production
builds.
+import { ClickToComponent } from 'click-to-react-component';
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
@@ -8,7 +7,6 @@ import reportWebVitals from './reportWebVitals';
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
+ <ClickToComponent />
<App />
</React.StrictMode>
);
+import { ClickToComponent } from 'click-to-react-component'
import type { AppProps } from 'next/app'
import '../styles/globals.css'
function MyApp({ Component, pageProps }: AppProps) {
return (
<>
+ <ClickToComponent />
<Component {...pageProps} />
</>
)
+import { ClickToComponent } from "click-to-react-component";
import React from "react";
import ReactDOM from "react-dom/client";
import App from "./App";
import "./index.css";
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<App />
+ <ClickToComponent />
</React.StrictMode>
);
npm install @babel/plugin-transform-react-jsx-source
babel.config.js:
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
plugins: [
...(process.env.BABEL_ENV === 'development'
? ['@babel/plugin-transform-react-jsx-source']
: []),
],
};
src/theme/Root.js:
import { ClickToComponent } from 'click-to-react-component';
import React from 'react';
// Default implementation, that you can customize
export default function Root({ children }) {
return (
<>
<ClickToComponent />
{children}
</>
);
}
editor
By default, clicking will default editor
to vscode
.
If, like me, you use vscode-insiders
, you can set editor
explicitly:
-<ClickToComponent />
+<ClickToComponent editor="vscode-insiders" />
Clone the project
gh repo clone ericclemmons/click-to-component
Go to the project directory
cd click-to-component
Install dependencies
pnpm install
Run one of the examples:
cd apps/cra
pnpm start
cd apps/next
pnpm dev
FAQs
Option+Click your React components in your browser to open the source file in VS Code
The npm package click-to-react-component receives a total of 44,037 weekly downloads. As such, click-to-react-component popularity was classified as popular.
We found that click-to-react-component demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
Research
Security News
Lazarus-linked threat actors expand their npm malware campaign with new RAT loaders, hex obfuscation, and over 5,600 downloads across 11 packages.
Security News
Safari 18.4 adds support for Iterator Helpers and two other TC39 JavaScript features, bringing full cross-browser coverage to key parts of the ECMAScript spec.