useState and aria expand is use boolean in Scss
aria-expand in set useState Toggle.
so useState bool is Toggle logic, change toggle the aria-expand CSS Fire.
display: none → block.
visibility: hidden → visible.
can use transition.
1import { useRecoilState } from "recoil";
2import { aboutState, linksState } from "libs/unique";
3const Filter: React.FC = () => {
4 const [about, setView] = useRecoilState(aboutState);
5 const [links, setLinks] = useRecoilState(linksState);
6 return (
7 <div className="Filter">
8 <div
9 aria-expanded={about || links}
10 onClick={() => {
11 setView(false);
12 setLinks(false);
13 }}
14 />
15 </div>
16 );
17};
18export default Filter;
and Recoil makes it easy to management state.
enjoy see you.