render () {
return (
<div className="row">
{ //Check if message failed
(this.state.message === 'failed')
? <div> Something went wrong </div>
: <div> Everything in the world is fine </div>
}
</div>
);
}
<div style={{'backgroundColor': status === 'approved' ? 'blue' : status === 'pending' ? 'black' : 'red'}}>
</div>
render () {
return (
<div className="row">
{ //Check if message failed
(this.state.message === 'failed')
? <div> Something went wrong </div>
: <div> Everything in the world is fine </div>
}
</div>
);
}
const matches = useMediaQuery('(max-width:600px)');
return (
<>
<Box className='innerSection'>
{matches ?
// Some Code
:
// Some Code
</Box>
}
</>
Ternary operator in react for Responsive Using MUI
ternaryoperator