Function

  • 1. Notes

    1. define a function inside the class

    
                 handleClick = () => {
                  console.log('Click happened');
                };
    
              

    2. function call

    
    
                import React from 'react';
    
                export function App(props) {
    
                  
    
                  handleClick = () => {
                    console.log('Click happened');
                  };
    
                  
                  return (
                    <div className='App'>
                      <h1>Hello React.</h1>
                      <h2>Start editing to see some magic happen! </h2>
                      <button onClick={this.handleClick}>Click Me</button>
                    </div>
                  );
                  
                }