⊗jsrtPmJxVI 13 of 112 menu

Inserting Variable and Constant Values ​​into JSX

Let's say we have the following code:

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

Let's make it so that the value of the constant str is inserted into the text of the div. To do this, our constant needs to be written in curly brackets inside, like this:

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

The following code is given:

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

Insert the first constant into the first paragraph and the second constant into the second.

enru