LogicStamp Context is designed to work seamlessly with React applications. It automatically detects React components, hooks, and patterns in your codebase.
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
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:
component(presentational) - JSX structure and element types
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
LogicStamp categorizes components into different kinds:
react:component- React functional components (with hooks, JSX, or React imports)react:hook- Custom React hooks (functions starting with "use" and no JSX)ts:module- TypeScript modules/utilities (non-React code)node:cli- Node.js CLI scripts (files in/cli/directory or usingprocess.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.
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
Event handlers and their types are captured:
function Form() {
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
// ...
};
return <form onSubmit={handleSubmit}>...</form>;
}Component state is extracted:
function Counter() {
const [count, setCount] = useState<number>(0);
const [isActive, setIsActive] = useState<boolean>(false);
// State extracted: { count: number, isActive: boolean }
}No special configuration needed for React projects:
# Scan React project
stamp context
# With style extraction (Tailwind, CSS Modules, etc.)
stamp context --include-style- 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)
- 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
- TypeScript Support - TypeScript-specific features
- Next.js Support - Next.js framework features
- Style Extraction - React styling patterns