update useInView hook

This commit is contained in:
DefectingCat
2022-08-12 11:04:31 +08:00
parent 047fc0c775
commit a83ee6ad1f
2 changed files with 15 additions and 13 deletions

View File

@ -21,8 +21,7 @@ const RUACodeSandbox = ({ url }: Props) => {
const currentTheme = theme === 'system' ? systemTheme : theme ?? 'light';
const { ref, inView } = useInView();
const sandUrl = new URL(url);
const embed = sandUrl.pathname.split('/')[2];
const embed = new URL(url).pathname.split('/')[2];
const [src, setSrc] = useState('');
useEffect(() => {
inView &&