<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>single line comment in react js - Wikitechy</title>
	<atom:link href="https://www.wikitechy.com/interview-questions/tag/single-line-comment-in-react-js/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wikitechy.com/interview-questions/tag/single-line-comment-in-react-js/</link>
	<description>Interview Questions</description>
	<lastBuildDate>Tue, 29 Mar 2022 12:08:52 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9</generator>

<image>
	<url>https://www.wikitechy.com/interview-questions/wp-content/uploads/2025/10/cropped-wikitechy-icon-32x32.png</url>
	<title>single line comment in react js - Wikitechy</title>
	<link>https://www.wikitechy.com/interview-questions/tag/single-line-comment-in-react-js/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>How to write comments in ReactJS ?</title>
		<link>https://www.wikitechy.com/interview-questions/reactjs/how-to-write-comments-in-reactjs/</link>
					<comments>https://www.wikitechy.com/interview-questions/reactjs/how-to-write-comments-in-reactjs/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Tue, 22 Mar 2022 07:39:47 +0000</pubDate>
				<category><![CDATA[ReactJS]]></category>
		<category><![CDATA[comment in react Code Example]]></category>
		<category><![CDATA[comments in jsx]]></category>
		<category><![CDATA[comments list reactjs Code Example]]></category>
		<category><![CDATA[how to comment in react js shortcut]]></category>
		<category><![CDATA[How to comment in React JSX]]></category>
		<category><![CDATA[how to comment react code in vscode]]></category>
		<category><![CDATA[How to use comments in React]]></category>
		<category><![CDATA[How to write comments in React and JSX]]></category>
		<category><![CDATA[how to write comments in react js]]></category>
		<category><![CDATA[How to write comments in ReactJS ?]]></category>
		<category><![CDATA[react comment reply component]]></category>
		<category><![CDATA[react commenting best practices]]></category>
		<category><![CDATA[react comments npm]]></category>
		<category><![CDATA[React Native Comments]]></category>
		<category><![CDATA[single line comment in react js]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=3976</guid>

					<description><![CDATA[ReactJS is a JS library used for building user interfaces. It is Declarative, Component-based and Technology stack agnostic. It is only designed for speed, simplicity, and scalability. It is some of the most popular libraries among web developers. For example(1), Comments for React Components: We can write comments in React using the double forward-slash // or [&#8230;]]]></description>
										<content:encoded><![CDATA[<ul>
<li style="text-align: justify;"><strong>ReactJS </strong>is a JS library used for building user interfaces.</li>
<li style="text-align: justify;">It is Declarative, Component-based and Technology stack agnostic.</li>
<li style="text-align: justify;">It is only designed for speed, simplicity, and scalability.</li>
<li style="text-align: justify;">It is some of the most popular libraries among web developers.</li>
</ul>
<p><strong>For example(1),</strong></p>
<p><strong>Comments for React Components: </strong></p>
<ul>
<li>We can write comments in React using the double forward-slash <strong>//</strong> or the asterisk format <strong>/* */</strong>, similar to regular JavaScript.</li>
</ul>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-markup code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-markup code-embed-code">import React, { Component } from &#039;react&#039;;<br/>  <br/>// This is a comment<br/>  <br/>class App extends Component {<br/>  <br/>    /* This is <br/>    also a comment*/<br/>    render() {<br/>        return (<br/>            &lt;div&gt;<br/>                &lt;h1&gt;Welcome to Kaashiv&lt;/h1&gt;<br/>            &lt;/div&gt;<br/>        );<br/>    }<br/>}<br/>  <br/>export default App;</code></pre> </div>
<p><strong>Output :</strong></p>
<p><img fetchpriority="high" decoding="async" class="img-responsive aligncenter wp-image-3977 size-full" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/welcome-to-kaashiv.png" alt="" width="1563" height="764" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/welcome-to-kaashiv.png 1563w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/welcome-to-kaashiv-300x147.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/welcome-to-kaashiv-1024x501.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/welcome-to-kaashiv-768x375.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/welcome-to-kaashiv-1536x751.png 1536w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/welcome-to-kaashiv-390x191.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/welcome-to-kaashiv-820x401.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/welcome-to-kaashiv-1180x577.png 1180w" sizes="(max-width: 1563px) 100vw, 1563px" /></p>
<p><strong>For example(2),</strong></p>
<p>In example(1) does not work when we want to comment on things inside the <strong>render block</strong>. we use JSX inside the render block and must use the multi-line comments in curly braces <strong>{/* */} </strong>.</p>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-markup code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-markup code-embed-code">import React, { Component } from &#039;react&#039;;<br/>  <br/>class App extends Component {<br/>    render() {<br/>        return (      <br/>            &lt;div&gt;<br/>                // This is not a valid comment<br/>                /* Neither is this */<br/>  <br/>                { /* THIS ONE IS A VALID COMMENT */ }<br/>}<br/>                  <br/>                &lt;h1&gt;Welcome to Kaashiv&lt;/h1&gt;<br/>            &lt;/div&gt;<br/>        );<br/>    }<br/>}<br/>  <br/>export default App; </code></pre> </div>
<p><strong>Output:</strong></p>
<p><img decoding="async" class="aligncenter wp-image-3978 size-full" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/welcome-to-kaashiv-1.png" alt="" width="1489" height="727" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/welcome-to-kaashiv-1.png 1489w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/welcome-to-kaashiv-1-300x146.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/welcome-to-kaashiv-1-1024x500.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/welcome-to-kaashiv-1-768x375.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/welcome-to-kaashiv-1-390x190.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/welcome-to-kaashiv-1-820x400.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/welcome-to-kaashiv-1-1180x576.png 1180w" sizes="(max-width: 1489px) 100vw, 1489px" /></p>
<p><strong>For example(3),</strong></p>
<p>We must remember, that even though JSX gets rendered just like normal HTML. It is actually a syntax extension to JavaScript. So, using <strong>&lt;!– –&gt;</strong> as we did with <strong>HTML and XML</strong> will not work.</p>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-markup code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-markup code-embed-code">import React, { Component } from &#039;react&#039;;<br/>  <br/>class App extends Component {<br/>    render() {<br/>        return (     <br/>            &lt;div&gt;<br/>                &lt;!-- This is not a valid comment --&gt;<br/>                  <br/>                {/* THIS ONE IS A VALID COMMENT */}<br/>                  <br/>                &lt;h1&gt;Welcome to Kaashiv&lt;/h1&gt;<br/>            &lt;/div&gt;<br/>        );<br/>    }<br/>}<br/>  <br/>export default App;</code></pre> </div>
<p><strong>Output:</strong></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><img decoding="async" class="alignnone size-full wp-image-4038" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/failed-to-compile.png" alt="" width="903" height="323" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/failed-to-compile.png 903w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/failed-to-compile-300x107.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/failed-to-compile-768x275.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/failed-to-compile-390x140.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/03/failed-to-compile-820x293.png 820w" sizes="(max-width: 903px) 100vw, 903px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/reactjs/how-to-write-comments-in-reactjs/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
