symref
Version:
Static code checker for AI code agents (Windsurf, Cline, etc.)
29 lines • 1.47 kB
JavaScript
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { useState, useEffect } from 'react';
// 子コンポーネント
const ChildComponent = () => {
const [count, setCount] = useState(0);
useEffect(() => {
document.title = `Count: ${count}`;
}, [count]);
return (_jsxs("div", { children: [_jsx("h2", { children: "Child Component" }), _jsxs("p", { children: ["Count: ", count] }), _jsx("button", { onClick: () => setCount(count + 1), children: "Increment" })] }));
};
// 別の子コンポーネント
function SecondChild() {
return (_jsxs("div", { children: [_jsx("h2", { children: "Second Child" }), _jsx("p", { children: "This is another child component." })] }));
}
// 孫コンポーネント(SecondChildではなくParentComponentから直接使用)
const GrandchildComponent = () => {
return (_jsx("div", { children: _jsx("h3", { children: "Grandchild Component" }) }));
};
// 親コンポーネント
const ParentComponent = () => {
return (_jsxs("div", { children: [_jsx("h1", { children: "Parent Component" }), _jsx(ChildComponent, {}), _jsx(SecondChild, {}), _jsx(GrandchildComponent, {})] }));
};
// App コンポーネント(ルート)
function App() {
return (_jsx("div", { className: "App", children: _jsx(ParentComponent, {}) }));
}
export default App;
export { ParentComponent, ChildComponent, SecondChild, GrandchildComponent };
//# sourceMappingURL=ComponentCallGraph.test.js.map