Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
221 views
in Technique[技术] by (71.8m points)

When to use string interpolation in React Native?

I know HOW to use string interpolation, but not sure when to use it. I have been teaching myself React Native lately, and the instructor used string interpolation on a button title. However, he didn't use it earlier in the course when he was passing a string variable into a Text tag.

Let me know if you need an example of what I am talking about.

Example:

How come this doesn't work?

<Button title='Hello my name is {myName}'/>

But this does

<Button title={`Hello my name is ${myName}`}/>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...