React Js / Basics / Events and functions
Events & function
-
1. Step
1. Normal function in functional components
function ActionLink() { function handleClick(e) { e.preventDefault(); console.log('You had clicked a Link.'); } return ( Click_Me ); } 2. Member function in class
class TestApp extends Component { clickHandler() { console.log(“clicked”) } render() { return ( ) } }3. passing parameter to the function
const App = () => { const handleClick = (name: string) => { alert(`Hello, ${name}!`); }; return ( ); };
MANVIA BLOG