Navigate back to the homepage

How to comment in react native

Infinitbility
React Native
August 3rd, 2021 · 1 min read
How to comment in react native

Hello Friends 👋,

Welcome To Infinitbility! ❤️

This tutorial wil help you to add comment in react native code, here you will get example of react native render comment, single line comments and multiple line comments.

If you’r familiar with jsx and js then you already know it.

Let start today topic How to comment in react native

In React Native comments syntax depend upon where you want comments.

React Native render comments example

Here render comment means where you use components.

Well, you want write comment in react native render method then you have to use simple comment syntax with curly brace somethings like {/* Your comment */}.

ReactNativeRenderComment.js

1import React from 'react';
2import {View,Text} from 'react-native';
3const App = () => (
4 <View>
5 {/* <Text>Hello World</Text> */}
6 </View>
7);
8export default App;

Other comments example

In other types comments we will use any place except render components. and hear also options for single line comment and multiple line comment.

let start with single line comment.

  • Single line comment example

single line comment syntax

1// single line comment

SingleLineCommentExample.js

1import React from 'react';
2import {Text} from 'react-native';
3
4// HelloWorld function
5const HelloWorld = ({name}) => <Text>Hello World {name}!</Text>;
6export default HelloWorld;
  • Multiple line comment example

Multiple line comment syntax

1/**
2 * Multiple line comment example
3 *
4 * @param {*} param0
5 * @returns
6 */

MultipleLineCommentExample.js

1import React from 'react';
2import {Text} from 'react-native';
3
4/**
5 * Print hello world
6 *
7 * @param {*} name
8 * @returns
9 */
10const HelloWorld = ({name}) => <Text>Hello World {name}!</Text>;
11export default HelloWorld;

Thanks For Reading…

Join our email list and get notified about new content

No worries, I respect your privacy and I will never abuse your email.

Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.

Looking For React Native Tutorial?

we are trying to create the best Tutorial for react native developers.

When you want a daily updates about React Native Tutorial or infinitbility update subscribe to our newsletter.

Read React Native Tutorial

Request New Tutorial or Article on mail [email protected]

Tutorials

React Native

Categories

More articles from Infinitbility

How to bold text in react native

How to bold text in react native

React Native bold effect

August 2nd, 2021 · 1 min read
How to clean gradle in react native

How to clean gradle in react native

React Native clean gradle example

August 2nd, 2021 · 1 min read
© 2020–2021 Infinitbility
About
Link to $https://medium.com/infinitbilityLink to $https://www.facebook.com/InfinitbilityLink to $https://github.com/infinitbilityLink to $https://twitter.com/infinitbilityLink to $https://www.buymeacoffee.com/infinitbilityLink to $mailto:[email protected]