You could do this:
function toggleIsShown(){
setIsShown([!isShown[0], isShown[1]]);
}
But overall this array of values is just going to lead to more confusion and problems. Are these two values even related? If not, separate them:
const [isShown,setIsShown] = React.useState(false);
const [someText,setSomeText] = React.useState("Hide");
Then toggling is semantically simpler:
function toggleIsShown(){
setIsShown(!isShown);
}
Or if these values are related, create a semantically meaningful object:
const [shownInfo,setShownInfo] = React.useState({ isShown: false, someText: "Hide" });
And update the property by name:
function toggleIsShown(){
setShownInfo({ ...shownInfo, isShown: !shownInfo.isShown });
}
The point is that arrays are not the right structure for grouping together random values. An array should represent a collection of some particular thing. These values you have are either unrelated (should be separate) or have some kind of semantic meaning in their relation (should be an object with named properties).