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

What are stateful components? in REACT

Practice



  1. If a component's behaviour depends on the state of the component, it can be called a stateful component. These stateful components are always class components and have state that is initialised in the

    constructor
    .
    class App extends Component {
      constructor(props) {
        super(props)
        this.state = { count: 0 }
      }
    
      render() {
        // ...
      }
    }

    React 16.8 update: hooks let you use state and other React features without writing classes.

    The equivalent functional component

    import React, {useState} from 'react';
    
    const App = (props) => {
      const [count, setCount] = useState(0);
    
      return (
        // JSX
      )
    }

 

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