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 [text1, setText1] = useState("FONTAWESOME"); const [text2, setText2] = useState("ICONS"); const [results, setResults] = useState(""); const myFunction = () => { setResults(text1.concat(text2)); }; return ( <> <h2>React js string.concat(text2) Method</h2> <button onClick={myFunction}>click me</button> <p>String 1: {text1}</p> <p>String 2: {text2}</p> <p>Combined string: {results}</p> </> ); } ReactDOM.render(<App />, document.getElementById("app")); </script> <style> h2 { font-size: 24px; font-weight: bold; } button { background-color: blue; color: white; padding: 8px 16px; border: none; border-radius: 4px; cursor: pointer; } button:hover { background-color: darkblue; } p { margin: 8px 0; font-size: 16px; } </style> </body> </html>