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?
We can write comments in React using the double forward-slash // or the asterisk format /* */, similar to regular JavaScript.
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.
Add Comments in React Native JSX using Visual Studio Code Editor. Ctrl + / on Windows + Linux. Cmd + / on MacOS.
Press Ctrl + / Two slashes “//” will be added to the front of each line, causing them to be recognized as a comment.
You can add comments in render like that : {/* COMMENT */}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With