Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add comment inside the return statement in render function?

Tags:

reactjs

Is there any possibilities we can add our comment inside the return statement in render functionality. For example find below the code snippet.

 render: function() {
    var value = this.state.value;
    return (
        <div>                         
            <input type="text" value={value} />
            <select value="B">
                <option value="A">Apple</option>
                <option value="B">Banana</option>
                <option value="C">Cranberry</option>
            </select>
        </div>); 
    ...

In the above code, I want to add my comment next to the <input> tag like Read-Only Textbox. Because it does not have onChange Event. How can i add it?

like image 362
Suresh Ponnukalai Avatar asked Oct 09 '15 10:10

Suresh Ponnukalai


People also ask

How do you add a comment in React render?

We can write comments in React using the double forward-slash // or the asterisk format /* */, similar to regular JavaScript.

How do you add a comment in JSX?

Syntax. JSX comments begin and end with curly braces {} . Followed by the opening curly brace is a forward slash and an asterisk. After that is the comment and lastly, an asterisk, a forward slash and the closing curly brace.

How do I comment a response code in Visual Studio?

Add Comments in React Native JSX using Visual Studio Code Editor. Ctrl + / on Windows + Linux. Cmd + / on MacOS.

How do you comment in Reactjs?

Press Ctrl + / Two slashes “//” will be added to the front of each line, causing them to be recognized as a comment.


1 Answers

You can add comments in render like that : {/* COMMENT */}

like image 83
noa-dev Avatar answered Sep 22 '22 00:09

noa-dev