Trying out variations of code in TicTacToe app. in react tutorial
Note: This post is a details-post for the post: Learning web app development through free online tutorials – Organized Notes and Log, https://raviswdev.blogspot.com/2024/03/learning-web-app-development-through.html . https://react.dev/learn/tutorial-tic-tac-toe Too many re-renders. React limits the number of renders to prevent an infinite loop, https://bobbyhadz.com/blog/react-too-many-re-renders-react-limits-the-number . This article gives the scenarios in which this error occurs. In my case, it was due to this scenario: “Calling a function that sets the state in the render method of a component.” It took me quite some time to figure it out. Finally I had this very small test file where the problem was being reproduced. Above page gave me further info. on it. My test file contents are given below: import { useState } from "react"; export default function MyApp() { const [cond, setCond] = useState(true); setCond(false); // Dummy statement to demonstrate t...