Reactjs How to write the greater than 0 in jsx?
this is my current code
return (
{num > 0 ? (
console.log('greater than 0')
):(console.log('less than zero')}
)
>Solution :
You mean you wanna display the evaluation on screen? There is a clean way to do that.
const App = () => {
...// logic you want
const comment = num > 0 ? 'greater than 0' : 'less than zero';
return <p>{comment}</p>
}