React native support comments, which is used to stop executing any line of code at compiling time in both Android and iOS react native applications. There are 2 types of comment syntax react native supports.
1. // ( Double Forward Slash ) : – Double Forward Slash is used to comment only single line in react native code.
1 2 3 |
var AB = 10 ; This line will be executed. // var AB = 10 ; This line will not be executed, This is Comment Line. |
2. { /* Your Code */} :- The second format is used to comment JSX code present inside render’s return box. You need to cover the your code into curly bracts then forward slash then star ( {/* ) now goto end of your code which you want to comment and put Star then forward Slash then Curly brackets ( */} ).
1 2 3 4 5 |
{/* <View style={styles.MainContainer}> <Button title="Sample Button" /> </View> */} |
Hi, what kind of version your react-native?
My react native project version is 0.49