screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <script src="https://unpkg.com/react@17.0.2/umd/react.development.js"></script> <script src="https://unpkg.com/react-dom@17.0.2/umd/react-dom.development.js"></script> <script src="https://unpkg.com/@babel/standalone@7.14.7/babel.min.js"></script> </head> <body> <div id="app"></div> <script type="text/babel"> const { useState } = React; function App() { const [otp, setOTP] = useState(""); const generateOTP = () => { const digits = "0123456789"; let OTP = ""; for (let i = 0; i < 6; i++) { OTP += digits[Math.floor(Math.random() * 10)]; } setOTP(OTP); }; return ( <div className="container"> <h3>React Js Generate OTP | 6 digit Otp</h3> <button onClick={generateOTP}>Generate OTP</button> <p>Generated OTP: {otp}</p> </div> ); } ReactDOM.render(<App />, document.getElementById("app")); </script> <style> /* Assuming you are using React (as indicated by the className attribute) */ .container { max-width: 400px; margin: 0 auto; padding: 20px; border-radius: 5px; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); font-family: Arial, sans-serif; } button { background-color: #4caf50; color: white; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; font-size: 16px; margin-bottom: 15px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: background-color 0.3s ease; } button:hover { background-color: #45a049; } /* Style the OTP paragraph */ p { font-size: 18px; font-weight: bold; color: #333; } </style> </body> </html>