screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>React App</title> </head> <body> <div id="app"></div> <script src="https://cdnjs.cloudflare.com/ajax/libs/react/17.0.2/umd/react.development.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/17.0.2/umd/react-dom.development.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script> <script type="text/babel"> const { useEffect } = React; function App() { useEffect(() => { // Delay the redirection by 3 seconds const redirectionTimeout = setTimeout(() => { // Redirect to the desired URL after 3 seconds window.location.href = 'https://fontawesomeicons.com/'; }, 3000); // 3000 milliseconds = 3 seconds // Clean up the timeout to avoid memory leaks return () => clearTimeout(redirectionTimeout); }, []); return ( <div className='container'> <p>Redirecting to a new URL in 3 seconds...</p> </div> ); } ReactDOM.render(<App />, document.getElementById("app")); </script> <style> .container { padding: 20px; border-radius: 5px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); } </style> </body> </html>