
React18 Batching Patterns
github/awesome-copilotOfficial
Diagnoses and fixes React 18 automatic batching regressions in class components, with a flushSync decision tree.
- skills.sh installs
- 757
- GitHub stars
- 41.4K
- last updated
- Aug 21, 2026
What it does
- Covers setState calls in async methods, setTimeout, Promise
.then()/.catch(), and native event handlers, comparing React 17 and React 18 behavior - Includes three fix categories (A, B, C) with before and after code in
references/batching-categories.mdandreferences/flushSync-guide.md - Enforces a diagnosis step first: code reading
this.stateafterawaitis classified as a silent state-read bug before any fix is chosen - Designed for teams upgrading class-component codebases to React 18, including fixing test failures from intermediate state assertions
Install
$ npx -y skills add github/awesome-copilot --skill react18-batching-patterns -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
React 18 Automatic Batching Patterns
Reference for diagnosing and fixing the most dangerous silent breaking change in React 18 for class-component codebases.
The Core Change
| Location of setState | React 17 | React 18 |
|---|---|---|
| React event handler | Batched | Batched (same) |
| setTimeout | Immediate re-render | Batched |
| Promise .then() / .catch() | Immediate re-render | Batched |
| async/await | Immediate re-render | Batched |
| Native addEventListener callback | Immediate re-render | Batched |
Batched means: all setState calls within that execution context flush together in a single re-render at the end. No intermediate renders occur.
Quick Diagnosis
Read every async class method. Ask: does any code after an await read this.state to make a decision?
Code reads this.state after await?
YES → Category A (silent state-read bug)
NO, but intermediate render must be visible to user?
YES → Category C (flushSync needed)
NO → Category B (refactor, no flushSync)
Details
- Repository
- github.com/github/awesome-copilot
- Categories
- Frontend & UI Code, Debugging
- First seen
- May 16, 2026
More from github/awesome-copilot
All 293- React18 Legacy Context749
- Code Tour748
- From The Other Side Vega746
- React18 Lifecycle Patterns746
- React18 String Refs744
- React18 Enzyme To Rtl743
- Linkedin Post Formatter362
- Ui Screenshots216
- Data Breach Blast Radius110
- Sql Server Table Reconciliation106
- Aws Cloudwatch Investigation
- Aws Cost Optimize
- Aws Resource Health Diagnose
- Aws Well Architected Review
- Azure Well Architected Review
- Bug Reproduction Brief
- Incident Postmortem
- Mcp Implementation Security Review
- Pester Migration
- Tm7 Threat Model
- Git Commit48.7K
- Excalidraw Diagram Generator34.6K
- Multi Stage Dockerfile31.7K
- Documentation Writer28.6K
Similar to React18 Batching Patterns
More Frontend & UI Code
react-modernizationwshobson/agents13.2K installsUpgrade guide for React apps covering version migrations, class-to-hooks conversion, and concurrent features.
react-performanceaffaan-m/ecc6.4K installsReact and Next.js performance rules grouped into 8 priority categories, from waterfalls to advanced patterns.
react18-lifecycle-patternsgithub/awesome-copilot746 installsMigrates the three unsafe class lifecycle methods to React 18.3.1 patterns using semantic decision tables.
react-audit-grep-patternsgithub/awesome-copilot886 installsGrep scan command library for auditing React codebases before React 18.3.1 or React 19 upgrades.
react-patternsjezweb/claude-skills1.3K installsReact 19 performance patterns and composition rules that prioritise waterfalls, bundle size, and re-render prevention.
vercel-react-best-practicesvercel-labs/agent-skills905.6K installsPerformance guide of 70 React and Next.js rules, ordered by impact from waterfalls to advanced patterns.