1.0.0 โ€ข Published 4 months ago

blinkreact v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

๐Ÿš€ BlinkReact


โœจ Features

  • ๐Ÿ”„ Render Count Tracking: Monitor how many times a component re-renders and detect unnecessary re-renders
  • โฑ๏ธ Render Time Measurement: Measure the time taken for initial and subsequent renders
  • ๐Ÿง  State Update Monitoring: Track state changes and detect redundant updates
  • ๐Ÿ› ๏ธ Performance Recommendations: Get actionable suggestions for optimizing your component

๐Ÿ“ฆ Installation

# Install globally
npm install -g blinkreact

# Or use npx without installing
npx blinkreact <component-file>

๐Ÿšฆ Usage

blinkreact path/to/your/component.tsx

๐Ÿ” How It Works

BlinkReact analyzes your React component through a 4-step process:

  1. ๐Ÿงช Instrumentation: Adds performance tracking code to your component
  2. ๐Ÿ“Š Render Analysis: Measures render counts and durations
  3. ๐Ÿ”„ State Analysis: Detects redundant state updates and inefficient patterns
  4. ๐Ÿ“ Report Generation: Creates a comprehensive performance report

๐Ÿ“„ Output

BlinkReact generates a detailed PERFORMANCE_REPORT.md file containing:

SectionDescription
๐Ÿ“Œ Component InfoComponent name and file path
โฑ๏ธ Render MetricsTotal renders, render times, unnecessary renders
๐Ÿง  State ManagementState updates and redundancy analysis
๐Ÿ’ก RecommendationsActionable optimization suggestions

๐Ÿ”ง Requirements

  • Node.js >= 14.0
  • React >= 18.0

๐Ÿ“Š Example Report

# BlinkReact Performance Report

## Component: `TodoList`

**File Path:** `src/components/TodoList.tsx`  
**Analysis Date:** 2023-05-15 10:30:45

## Render Performance

- **Total Renders:** 5
- **Average Render Time:** 3.45ms
- **Maximum Render Time:** 8.12ms
- **Unnecessary Renders:** 2

## State Management

- **Total State Updates:** 10
- **Redundant State Updates:** 2

## Performance Recommendations

- **Reduce Unnecessary Renders:** Consider using `React.memo()` to prevent re-renders when props haven't changed.
- **Optimize Render Performance:** The component has slow renders. Consider breaking it down into smaller components.
- **Reduce Redundant State Updates:** The component has redundant state updates. Consider using functional updates.

๐Ÿค Contributing

Contributions, issues and feature requests are welcome! Feel free to check the issues page.

๐Ÿ“ License

This project is ISC licensed.