💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
1. 在 HTML 中事件名必须小写: ~~~html <button onclick='activateLasers()'> ~~~ 而在 React 中它遵循*camelCase*(驼峰) 惯例: ~~~js <button onClick={activateLasers}> ~~~ 2. 在 HTML 中你可以返回`false`以阻止默认的行为: ~~~html <a href='#' onclick='console.log("The link was clicked."); return false;' /> ~~~ 而在 React 中你必须地明确地调用`preventDefault()`: ~~~js function handleClick(event) { event.preventDefault() console.log('The link was clicked.') } ~~~ ## 参考 [react面试题](https://github.com/semlinker/reactjs-interview-questions)