React's setState hook setter function should not be called directly in the body of a component, otherwise it would produce an infinite render loop. This can happen by mistake. Most commonly, the setter function is called from an event handler.
== Noncompliant Code Example
[source,javascript]
----
import { useState } from "react";
function ShowLanguage() {
const [language, setLanguage] = useState("fr-FR");
// Makes an infinite loop
setLanguage(navigator.language);
return (