Skip to content
Snippets Groups Projects
Select Git revision
  • 22f2a89006935e535a3f754ee32ac56849444586
  • master default
2 results

example

Blame
  • Forked from HyukSang Kwon / 1801_OS_assignment4
    Source project has a limited visibility.
    BottomSheet.tsx 772 B
    import {useContext, useEffect, useState} from "react";
    import {useLocation} from "react-router-dom";
    
    import {BSContext} from "../../../contexts/bottom-sheet";
    
    import S from './BottomSheet.module.css';
    
    import type {FC} from "react";
    
    const BottomSheet: FC = () => {
        const { bSElement, setBSElement, flushBSElement } = useContext(BSContext);
        const [retEl, setRetEl] = useState(<></>);
        const location = useLocation();
        
        useEffect(() => {
            flushBSElement();
        }, [location]);
        
        useEffect(() => {
            if (bSElement) setRetEl(
                <div className={S['container']}>
                    {bSElement}
                </div>
            );
            else setRetEl(<></>);
        }, [bSElement]);
        
        return retEl;
    };
    
    export default BottomSheet;