Too many re-renders. React limits the number of renders to prevent an infinite loop in React
import React from ‘react’ import { useState } from ‘react’ export default function About(props) { const [theme,setTheme] = useState(null) function toggle(option){ if(option===”light”){ setTheme({ color:”black”, backgroundColor:”white”, width:”90%”, marginInline:”auto” }) console.log(theme,option===”light”); // return theme }else if(option===”dark”){ setTheme({ color:”white”, backgroundColor:”black”, width:”90%”, marginInline:”auto” }) console.log(theme,option===”light”); // return theme }else{ setTheme({ color:”white”, backgroundColor:”#032f3c”, width:”90%”, marginInline:”auto” }) console.log(theme,option===”light”); // return theme […]
React routing nothing shows up other than old background color
i am actually using V6 React Router Dom i made my index.js my routinng file :