react component emit event code example
Example 1: handling event in jsx
//Event hadling in react
function ActionLink() {
function handleClick(e) {
e.preventDefault();
console.log('The link was clicked.');
}
return (
<a href="#" onClick={handleClick}>
Click me
</a>
);
}
Example 2: react actions sintaxe
const actionsSintaxe = (element) => ({ type: "@smthg/ACTION", element });
// ACTION = REMOVE, ADD etc...