i create a use state in my react component like that:
const [loading, setLoading] = React.useState(false);
and in one project in return of component i saw something like this
<ListItemButton sx={{ color: `${loading && 'yellow'}` }}>
I can’t find how that `${x && 'x' }` syntax works
Can someone explain to me or show me the documentation of this?
>Solution :
It’s logical AND ( && ) operator, and next thing will execute incase if true condition
let yellow = true;
console.log( yellow && "Yellow color" )
let blue = false;
console.log( blue && "Blue color" )