Successfully added
React
by Patrik
Inline function in an onClick event handler in React
Inline functions allow you to write code for event handling directly in JSX. See the example below:
import React from "react";
const App = () => {
return (
<button onClick={() => alert("Hello!")}>Say Hello</button>
);
};
export default App;
Referenced in:
Comments