Advertisement
karlakmkj

React (JSX) - Multiline JSX in a Component

Jan 24th, 2021
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React from 'react';
  2. import ReactDOM from 'react-dom';
  3.  
  4. class Quote extends React.Component {
  5.   render(){
  6.     return (  //multi-line JSX expression should always be wrapped in parentheses! Hence return has parentheses around it
  7.       <blockquote>
  8.   <p>
  9.     What is important now is to recover our senses.
  10.   </p>
  11.   <cite>
  12.     <a target="_blank"
  13.       href="https://en.wikipedia.org/wiki/Susan_Sontag">
  14.       Susan Sontag
  15.     </a>
  16.   </cite>
  17. </blockquote>
  18.     );
  19.   }
  20. };
  21.  
  22. ReactDOM.render(<Quote />, document.getElementById('app'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement