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"> function App() { const someValue = 'someCondition'; return ( <div className='container'> <h3>React js Conditional Rendering Using the ternary operator</h3> {someValue === 'someCondition' ? ( <p className='classNameForPTrue'>This content is displayed when the condition is true.</p> ) : ( <p className='classNameForPFalse'>This content is displayed when the condition is false.</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); text-align: center; } .classNameForPTrue { font-size: 16px; color: green; /* Change the color to your preference */ } .classNameForPFalse { font-size: 16px; color: red; /* Change the color to your preference */ } </style> </body> </html>