Will It Vibe logoWill It Vibe?
REACT-007Medium severity-8 points

Direct state mutation in a class component

Part of Code Quality & Syntax, which counts for 20% of the overall score. When this check fires it deducts 8 points from that category, once per scan, no matter how many places it turns up.

What it detects

Assigning to this.state.x or calling a mutating method (push, splice, sort) on it changes state without going through setState, so React never re-renders and the change is lost or applied inconsistently.

Why it matters

Assigning to this.state.x, or calling push/splice/sort on something inside this.state, changes the state object in place without telling React. React compares state by reference to decide whether to re-render, so an in-place mutation is often not rendered at all, or is rendered inconsistently, producing bugs that are hard to reproduce.

How to fix it

Always go through setState with a new value. For arrays and objects, build a new copy: setState({ items: [...this.state.items, next] }) or the updater form setState(prev => ...). Never write to this.state directly except the initial assignment in the constructor.

The paid report includes a ready-to-paste prompt for your AI coding agent for every check it finds, pointed at the exact findings from your scan. See pricing

Does your repo trip this check?

Paste a GitHub URL or drop a project folder. Scans run in your browser and take seconds.

Scan your repo

Related Code Quality & Syntax checks