I can use a double and single quote to concatenate my dynamic variable but template string is cleaner. I got an unexpected token, any clue why?
...
return (<UserList id={subactions} key=`applications${query.status}` />)
...
Template strings bring simple string interpolation to JavaScript. That is, they're a nice-looking, convenient way to plug JavaScript values into a string. In this example, ${user.name} and ${action} are called template substitutions . JavaScript will plug the values user.name and action into the resulting string.
Use a template literal to concatenate strings and variables in React, e.g. "<a href={ https://example.com/${myPath} }". Template literals are delimited with backticks and allow us to embed variables and expressions using the dollar sign and curly braces ${expression} syntax.
React uses ES6, and you should be familiar with some of the new features like: Classes. Arrow Functions. Variables (let, const, var)
You need to change it to the code below.
return (<UserList id={subactions} key={ `applications${query.status}` } />)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With