function useCachedState<T>(
key: string,
initialState?: T,
config?: {
cacheNamespace?: string;
}
): [T, (newState: T | ((prevState: T) => T)) => void];
import { List, ActionPanel, Action } from "@raycast/api";
import { useCachedState } from "@raycast/utils";
export default function Command() {
const [showDetails, setShowDetails] = useCachedState("show-details", false);
return (
<List
isShowingDetail={showDetails}
actions={
<ActionPanel>
<Action title={showDetails ? "Hide Details" : "Show Details"} onAction={() => setShowDetails((x) => !x)} />
</ActionPanel>
}
>
...
</List>
);
}