import React, { useEffect, useState } from 'react'; import { closeTabs } from 'providers/ReduxStore/slices/tabs'; import { useDispatch } from 'react-redux'; const RequestNotFound = ({ itemUid }) => { const dispatch = useDispatch(); const [showErrorMessage, setShowErrorMessage] = useState(false); const closeTab = () => { dispatch( closeTabs({ tabUids: [itemUid] }) ); }; useEffect(() => { setTimeout(() => { setShowErrorMessage(true); }, 300); }, []); // add a delay component in react that shows a loading spinner // and then shows the error message after a delay // this will prevent the error message from flashing on the screen if (!showErrorMessage) { return null; } return (