NA +91-8727899942 thecoderjob@gmail.com

CHAPTER - 17

Pass function as Props

  • Example :

function Parent() {

  function getData() {

    alert("Hello from app component")

  }

  return (

    <> <Child  data={getData} /> </>

  );

}

function Child(props) {

    return(

        <>

            <button onClick={props.data}> Call Function </button>

        </>

    )

}

 

Chapter 16

If-Else condition

Previous chapter

Chapter 18

Life cycle

Next chapter

Get In Touch

NA

thecoderjob@gmail.com

+91-8727899942

Popular Links

© www.thecoderjob.com. All Rights Reserved.               Designed by HTML Codex