简体   繁体   中英

How to pass string value in onClick event listener in Javascript as we do it in onclick event listener in html

render() {
    return (
      <div>
        <div
          onClick={() =>
            "FSR.launchFeedback('ax9sgJjdSncZWoES6pew6wMIyCgSXpC')"
          }
        />
      </div>
    );
  }

this doesn't work but after this dom gets loaded in the browser and when I add "FSR.launchFeedback('ax9sgJjdSncZWoES6pew6wMIyCgSXpC')" as a value in the onclick attribute in the similar div, it works.

is FSR.launchFeedback is function ? if it is function then you need to write like this

onClick={() =>
            FSR.launchFeedback('ax9sgJjdSncZWoES6pew6wMIyCgSXpC')
          }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM