screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <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> </head> <body> <div id="app"></div> <script type="text/babel"> function getStringLength(str) { return str.length; } function App() { const myString = 'This is Font Awesome icons.com '; return ( <div className='container'> <h3 className='title'>React Js String Length Example 2</h3> <p className='text'>My string: {myString}</p> <p className='text'>Length of the string: {getStringLength(myString)}</p> </div> ); } ReactDOM.render(<App />, document.getElementById('app')); </script> <style> /* Style the container */ .container { max-width: 600px; margin: 0 auto; padding: 20px; text-align: center; border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); } .title { font-size: 24px; color: #333; } .text { font-size: 16px; color: #555; margin: 10px 0; } </style> </body> </html>