Im switching classes and text with React Aria this way ->
const [toggle, setToggle] = useState(false);
const toggler = () => {
toggle ? setToggle(false) : setToggle(true);
};
{toggle ? "Off" : "On"}{state.isSelected ? "Off" : "On"}
The additional state.isSelected is a preset React Aria state that I also want to use... This works so i can toggle the element with the mouse and the keyboard, but obviously now I have double the text... How could i combine "toggle" and "state.isSelected" into one command / line?
Something like =>
{toggle ? state.isSelected ? "Off" : "On"}
which obviously doesn't work.
Id also like to toggle my classes this way =>
${toggle ? OR state.isSelected ? styles.ToggleActiveOff : styles.ToggleActiveOff}
So, if i toggle with the mouse Or if i toggle with the spacebar, change class / text