skip to Main Content

Code that I am using

I am new learner of react. Actually, I am trying to return multiple jsx elements inside a div element.
But it is not working, and, in the terminal, there shows two errors which I have depicted in the picture above. And my output page is just blank. Even in the console it is not appearing.

Any help to solve this would be appreciated.

2

Answers


  1. You have "unreachable code" warning. It means that code after 6 line is not visible for some reason. Looks like that something happens inside the transpilar. Try to remove {}

    function Hello() {
       return <div>
         <p>hi hello</p>
         <h1>hello</h1>
       </div>
    }
    
    Login or Signup to reply.
  2. just a minor mistake in the return statement should encompass ‘()’ not ‘{}’

    function Hello(){
    return(
           <div>
            <p>hi hello</p>
            <h1>Hello</h1>
           </div>
          )
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search