A

Admin • 833.24K Points
Coach

Q. What is the correct syntax to pass a function as a prop?

  • (A) <MyComp func='doSomething' />
  • (B) <MyComp func={doSomething} />
  • (C) <MyComp func={doSomething()} />
  • (D) <MyComp func=doSomething />
  • Correct Answer - Option(B)
  • Views: 26
  • Filed under category React JS
  • Hashtags:

Explanation by: Admin

Functions are passed as props using curly braces without invoking them.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.