What does the $ symbol mean in React Native?

In terms of props in React Native, what does $ mean?

eg. backgroundImage: 'url ($ {contact.avatarURL})'

+3


source to share


3 answers


It's called template literals ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals )

$ refers to the var / let / const variable that you want to embed in the string.



example:

const location = "Bali";

console.log(`Hello, ${location}`); //Hello, Bali

      

+3


source


This is ES6 string interpolation / template strings using `(backticks) and $ {expr} (interpolated expression).

Resource



Template literals are string literals that allow inline expressions. They can be used with multi-line strings and string interpolation functions. These were called "pattern strings" in previous releases of the ES2015 specification.

+1


source


This refers to template literals, you can read the official documentation : Javascript Syntax Transformers . ReactNative

Or

Check out the documentation for : ES6 Feature . ES6

0


source







All Articles