0

Browser give me this error enter image description here What I'm doing wrong? This appeared only when I added the code for the loader

    function App(){
     const [loading, setLoading] = useState(false);
        
        useEffect(() => {
          setLoading(true)
          setTimeout(() => {
            setLoading(false)
          }, 5000)
        }, [])
        
        
          return (
            <div className="App">
        {
                loading ? 
                <img src={loader} alt=""
                loading={loading}
                />
              :
         //all my code
     
    }
     </div>
)}
  • Can you provide complete code in else condition of loading? – Milind Sharma Jun 29 '21 at 15:40
  • There can only be one parent element in the JSX that's in the return. Enclose it in Fragment if there are multiple elements. That means you can't have `return (
    whatever
    ` - it has to be all one parent like `return (
    `
    – Nikki9696 Jun 29 '21 at 15:43

0 Answers0