title: How to change class component to function component in reactjs?
body: <p>I am using Ant design library in reactjs.</p>
  <p>How do I change a class component  to function component ?</p>
  <pre><code>import { Accordion, List } from 'antd-mobile';
  
  class AccordionExmple extends React.Component {
    onChange = (key) =&gt; {
      console.log(key);
    }
    render() {
      return (
        &lt;div style={{ marginTop: 10, marginBottom: 10 }}&gt;
          &lt;Accordion defaultActiveKey=&quot;0&quot; className=&quot;my-accordion&quot; onChange={this.onChange}&gt;
            &lt;Accordion.Panel header=&quot;Title 1&quot;&gt;
              &lt;List className=&quot;my-list&quot;&gt;
                &lt;List.Item&gt;content 1&lt;/List.Item&gt;
                &lt;List.Item&gt;content 2&lt;/List.Item&gt;
                &lt;List.Item&gt;content 3&lt;/List.Item&gt;
              &lt;/List&gt;
            &lt;/Accordion.Panel&gt;
            &lt;Accordion.Panel header=&quot;Title 2&quot; className=&quot;pad&quot;&gt;this is panel content2 or other&lt;/Accordion.Panel&gt;
            &lt;Accordion.Panel header=&quot;Title 3&quot; className=&quot;pad&quot;&gt;
              text text text text text text text text text text text text text text text
            &lt;/Accordion.Panel&gt;
          &lt;/Accordion&gt;
        &lt;/div&gt;
      );
    }
  }
  
  ReactDOM.render(&lt;AccordionExmple /&gt;, mountNode);
  </code></pre>
  <p>This is code example.
  I want to use this component as function</p>