Calling a javascript function in JSX: why does calling a function without the () work?

前端 未结 2 914
广开言路
广开言路 2021-01-01 05:50

Currently on Codecademy and learning about React.

Came to this code:

2条回答
  •  南笙
    南笙 (楼主)
    2021-01-01 06:39

    No need for too much stress the solution is just double quote elimination "", in ReactJs to call a function inside an element you just have to do the following

    onClick={functionName}
    

    React can process function in curly braces.

提交回复
热议问题