React renders FCs multiple times

React will rerun the whole template code if either a prop or a state changes.

import React from "react";

function Counter({ max }: { max: number }) {
  const [count, setCount] = React.useState(0);

  return (
    <div>
      <p>You clicked {count} times</p>
      <button onClick={() => setCount(count + 1)}>Click me</button>
    </div>
  );
}

The Counter component will rerun the whole template code if either the max prop or the count state changes.

This is in direct contrast to the

Signal-based SolidJS.