diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 000000000..2ba986f6f --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "chrome", + "request": "launch", + "name": "Launch Chrome against localhost", + "url": "http://localhost:8080", + "webRoot": "${workspaceFolder}" + } + ] +} \ No newline at end of file diff --git a/Eve-fests_web/Frontend_Eve-fests/React4Frontend b/Eve-fests_web/Frontend_Eve-fests/React4Frontend new file mode 100644 index 000000000..f7dc2ae2a --- /dev/null +++ b/Eve-fests_web/Frontend_Eve-fests/React4Frontend @@ -0,0 +1,70 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import './index.css'; +import App from './App'; +import reportWebVitals from './reportWebVitals'; + +var element = React.createElement('h1', { className: 'greeting' }, 'Hello, world!'); +ReactDOM.render(element, document.getElementById('root')); + +reportWebVitals(); + +import React, { useState } from 'react'; + +function App() { + const [isRegistering, setIsRegistering] = useState(true); + const [email, setEmail] = useState(''); + const [password, setPassword] = useState(''); + const [loggedInUser, setLoggedInUser] = useState(null); + + const handleToggleMode = () => { + setIsRegistering(!isRegistering); + }; + + const handleAuth = () => { + if (isRegistering) { + // Simulated user registration + console.log('User registered with email:', email); + } else { + // Simulated user login + console.log('User logged in with email:', email); + setLoggedInUser(email); // Set the user's email as the logged-in user + } + }; + + return ( +
Welcome, {loggedInUser}!
+ ++ {isRegistering ? 'Already have an account? Log in' : 'Don\'t have an account? Register'} +
+