⊗jsrtPmJxVN 14 of 112 menu

Nuances when inserting variable values

In addition to inserting a constant, there may be some other text in the tag:

function App() { const str = 'text'; return <div> eee {str} bbb </div>; }

You can insert as many constants as you want into one tag:

function App() { const str1 = 'text1'; const str2 = 'text2'; return <div> {str1} {str2} </div>; }

Constant insertions can also be separated by some text:

function App() { const str1 = 'text1'; const str2 = 'text2'; return <div> {str1} eee {str2} </div>; }

The following code is given:

function App() { const name = 'user'; const age = '30'; return <div> name: ? age: ? </div>; }

Insert a constant with the name instead of the first character ?, and a constant with the age instead of the second.

English
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline