Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

react

React Elements
- uses JSX (Java script functions)

React Element Attributes
<div className="container"></div>

React Element Styles
{/* Inline styles */}
<h1 style={{ fontSize: 24, margin: '0 auto', textAlign: 'center' }}>My header</h1>

React Fragments
// valid syntax
function MyComponent() {
  return (
    <>
      <h1>My header</h1>
      </p>My paragraph</p>
    </>
  );
}

We can write fragments in a regular or shorthand syntax: <React.Fragment></React.Fragment> or <></>.
Source by reactjs.org #
 
PREVIOUS NEXT
Tagged: #react
ADD COMMENT
Topic
Name
2+3 =