I've taken my app to bare minimum to try to understand why it is infinite looping...but I don't get it.
const App = () => {
console.log("just logging that the app ran!")
const [data, setData] = useState('initial state');
const getAsset = async () => {
console.log("logging that getAsset ran!")
setData("new state!")
console.log(data)
}
getAsset();
return (
<div >
{data}
</div>
);
}
export default App;
Any pointers?
The error message:
react-dom.development.js:14997 Uncaught Error: Too many re-renders. React limits the number of renders to prevent an infinite loop.