function Price(props){
<span>This item is ${props.price}</span>
}
I want to use $ as a string, but it doesn't work due to JSX syntax. how can I fix it?
CodePudding user response:
This code will display '$' as a string, '$' is not a special character in JSX, you may be thinking JQuery
CodePudding user response:
This should work as is. Also, You could try another approach using template literal syntax:
{`Hello the price is $${price}.`}