score:1

Accepted answer

in your square component, you should not call directly the props.onclick:

function square(props) {
    return (
        <button
            classname="square"
            onclick={props.onclick}
        >
            {props.value}
        </button>
    );
}

it calls the state at the render and create the infinite loop.


Related Query

More Query from same tag