React Framework Support
LogicStamp Context is designed to work seamlessly with React applications. It automatically detects React components, hooks, and patterns in your codebase.
React Detection
LogicStamp automatically identifies React code by:
- File extensions:
.tsxand.tsfiles - JSX syntax: React component declarations and JSX elements
- React imports: Detects imports from
reactandreact-dom - Component patterns: Functional components, class components, and hooks
Components
React components are automatically detected and analyzed:
// Example: Button.tsx
import React from 'react';
interface ButtonProps {
label: string;
onClick: () => void;
}
export function Button({ label, onClick }: ButtonProps) {
return <button onClick={onClick}>{label}</button>;
}Extracted information:
- Component name:
Button - Props interface:
ButtonPropswithlabelandonClick - Component kind:
react:component - JSX structure and element types
React Hooks
All React hooks are detected and categorized:
import { useState, useEffect, useCallback } from 'react';
function MyComponent() {
const [count, setCount] = useState(0);
const memoizedCallback = useCallback(() => {
// ...
}, []);
useEffect(() => {
// ...
}, []);
}Extracted hooks:
useState- State managementuseEffect- Side effectsuseCallback- Memoized callbacksuseMemo- Memoized valuesuseRef- RefsuseContext- Context consumption- Custom hooks
Component Kinds
LogicStamp categorizes components into different kinds:
react:componentReact functional components (with hooks, JSX, or React imports)
react:hookCustom React hooks (functions starting with "use" and no JSX)
ts:moduleTypeScript modules/utilities (non-React code)
node:cliNode.js CLI scripts (files in /cli/ directory or using process.argv)
Note: The container, page, and layout kinds mentioned in some documentation are not currently implemented. All React components are classified as react:component regardless of whether they have state, side effects, or are used as pages/layouts.
Props Extraction
TypeScript interfaces and prop types are fully extracted:
interface UserCardProps {
user: {
id: string;
name: string;
email: string;
};
onEdit?: (id: string) => void;
variant?: 'default' | 'compact';
}
export function UserCard({ user, onEdit, variant = 'default' }: UserCardProps) {
// ...
}Extracted props:
user: Object withid,name,emailonEdit: Optional functionvariant: Optional union type with default value
State Management
Component state is extracted:
function Counter() {
const [count, setCount] = useState<number>(0);
const [isActive, setIsActive] = useState<boolean>(false);
// State extracted: { count: number, isActive: boolean }
}Usage
No special configuration needed for React projects:
# Scan React project
stamp context
# With style extraction (Tailwind, CSS Modules, etc.)
stamp context --include-styleBest Practices
- Use TypeScript: LogicStamp works best with TypeScript for accurate type extraction
- Type your props: Explicit prop interfaces improve extraction quality
- Component organization: LogicStamp respects your folder structure
- Hook naming: Use
useprefix for custom hooks (React convention)
Limitations
- Class components are supported but functional components are preferred
- React Server Components (RSC) are detected but may have limited extraction
- Dynamic imports are tracked but not fully resolved
Next Steps
Get started with LogicStamp Context or explore other framework integrations.