className={`${checked ? "switchbar" : "switchbar2 "} test`}
style = {{
backgroundColor: "gray",
height: 50,
width: 50,
borderRadius: 100,
...(checked &&{backgroundColor: "yellow"})
}}
import ClassName from "classnames";
...
className={classNames("test",{
switchbar1: true,
switchbar2: false
})}