-2

I'm currently learning React Native and wondering why some props have values in quotes "" and some have their values in curly braces {}.

Is there a standard to when I should be using quotes vs braces?

<Button title="Press me" onPress={() => console.log("Hello")}/>

For example, in the line above the title is written using quotes but the onPress property uses the curly braces.

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
YD8877
  • 10,401
  • 20
  • 64
  • 92

1 Answers1

0

Quotes are for when you're passing a simple string.

Braces are for when you want to run Javascript code. For example if you wanted to pass a variable as a prop, you'd need to use braces.

I personally try to use quotes whenever possible, but most of the times you need to use braces.

Vid
  • 440
  • 4
  • 10