Link Search Menu Expand Document

Api

API

useState

import React, { useState } from 'react';

function Example() {
  // Declare a new state variable, which we'll call "count"  const [count, setCount] = useState(0);
  return (
    <div>
      <p>You clicked {count} times</p>
      <button onClick={() => setCount(count + 1)}>
        Click me
      </button>
    </div>
  );
}

async

  • source: 1
this.setState(function(state, props) {
  return {
    counter: state.counter + props.increment
  };
});


Children

  1. Hooks
  2. Use Memo
  3. Use State
  4. Use-effect