Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to comment HTML within React written in TypeScript?

Tags:

People also ask

How do you comment in a TypeScript React?

Multi-Line Comment If you want to comment something in JSX you need to use JavaScript comments inside of Curly braces like {/*comment here*/}. It is a regular /* Block Comments */ , but need to be wrapped in curly braces.

How do you comment multiple lines in React?

Multi-Line Comment If you want to comment something in JSX you need to use JavaScript comments inside of Curly braces like {/*comment here*/}. It is a regular /* Block Comments */ , but need to be wrapped in curly braces.

How do you comment in HTML code?

HTML <!--...--> Tag The comment tag is used to insert comments in the source code. Comments are not displayed in the browsers.


class MyClass extends React.Component<any, any> {
    render(): JSX.Element {
        return (<div>
            /*<div>{this.state.myVal} Not Working</div>*/
            ///<div>{this.state.myVal} Not Working</div>
            <!--<div>{this.state.myVal} Not Working</div>-->
            </div>);
    }
}

I have tried the above 3 ways to comment an entire line. None seem to work. I'm using Visual Studio if it makes a difference.