-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
  • 107,083
  • 22
  • 201
  • 376
YD8877
  • 9,852
  • 20
  • 59
  • 90

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
  • 338
  • 3
  • 9