Counter with Mutation Tracking

React Unforget can trace statements that will mutate a variable.

Input Code
import { useState } from "react";

export default function CounterWithMutationTracking() {
  const [state, setState] = useState(0);

  let text = "The number is: ";

  if (state % 2 === 0) {
    text += "even";
  } else {
    text += "odd";
  }

  return (
    <div>
      <button onClick={() => setState(state + 1)}>Increment</button>
      <div>
        <span>Count: {state}</span> {text}
      </div>
    </div>
  );
}

React Unforget Result

export default function App() {
  return <div>Compiling...</div>;
}

Read-only
Click here to view the dependency graph