Are you first timer at lazacode.org? Why not join us and start exchange your programming knowledge with everyone. Register today!

React - Stateless component

0 votes
7 views
added Mar 11 in React by LC Marshal Captain (20,510 points)

The component consist of 2 sub-components within. Header and Content were called in JSX tree. 

import React from 'react'

class StatelessComponent extends React.Component {
   render() {
      return (
         <div>
            <StatelessHeader/>
            <StatelessContent/>
         </div>
      );
   }
}
class StatelessHeader extends React.Component {
   render() {
      return (
         <div>
            <h1>Header here</h1>
         </div>
      );
   }
}
class StatelessContent extends React.Component {
   render() {
      return (
         <div> 
            <p>Content goes here</p>
         </div>
      );
   }
}
export default StatelessComponent;

 

Please log in or register to response this reference.

lazacode.org - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.
...