You get a bonus - 1 coin for daily activity. Now you have 1 coin

How to create components in React? in REACT

Practice



There are two possible ways to create a component.

  1. Function components: this is the simplest way to create a component. These are pure JavaScript functions that take a props object as their first parameter and return React elements:

    function Greeting({ message }) {
      return <h1>{`Hello, ${message}`}</h1>
    
    }
  2. Class components: You can also use an ES6 class to define a component. The function component above can be written as:

    class Greeting extends React.Component {
      render() {
        return <h1>{`Hello, ${this.props.message}`}</h1>
      }
    }

Comments

To leave a comment

If you have any suggestion, idea, thanks or comment, feel free to write. We really value feedback and are glad to hear your opinion.
To reply

Lectures and tutorial on "Scripting client side JavaScript, jqvery, BackBone"

Terms: Scripting client side JavaScript, jqvery, BackBone