Warning: Internal React error: Expected static flag was missing. Please notify the React team
复现的代码
import { useEffect, useRef } from 'react'
import React from 'react';const ModalShop = ({ isVisible, onClose }) => {if (!isVisible) return null;const handleClose = (e) => {if (e.target.id === 'wrapper') { onClose(); }}const inputRef = useRef(null);const spanRef = useRef(null);useEffect(() => {...}, []);return (...
}export default ModalShop;
解决:
if (!isVisible) return null; // 移动到钩子后面