I am trying to understand some uses of clsx in assigning classnames to a component in React.
The construct
className={clsx(classes.menuButton, open && classes.hide)}
is clear enough. It applies classes.menuButton
, and also applies classes.hide
if the value of the boolean open
is true
.
My question relates to this second example:
className={clsx(classes.appBar, {[classes.appBarShift]: open })}
This will apply classes.appBar
. But what is the meaning of the second parameter?