skip to Main Content

I want to comment out a giant block of code that already has react comments in it, but doing so will not work.

E.g.

{/*
                {/* my comment */}
                <div className="flex flex-col px-4 space-y-1 border-b pb-2 mt-2">
*/}

This fails

2

Answers


  1. That’s what I could figure out

    {() => `/*{/* my comment */}
        <div className="flex flex-col px-4 space-y-1 border-b pb-2 mt-2"></div>
        */`}
    
    Login or Signup to reply.
  2. What is causing you issues is the close comment indicator on the inner comment. React doesn’t see comments inside of comments. If you remove the * / or even just the * from the line {/* my comment */} React will move on to the next close comment indicator.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search