react onclick typescript type
onClick={(event: React.MouseEvent<HTMLElement>) => {
makeMove(ownMark, (event.target as any).index)
}}
react onclick typescript type
onClick={(event: React.MouseEvent<HTMLElement>) => {
makeMove(ownMark, (event.target as any).index)
}}
handler for button in react typescript
const handleAddToCart = (clickedItem: CartItemType) => {
setCartItems(prev => {
// 1. Is the item already added in the cart?
const isItemInCart = prev.find(item => item.id === clickedItem.id);
if (isItemInCart) {
return prev.map(item =>
item.id === clickedItem.id
? { ...item, amount: item.amount + 1 }
: item
);
}
// First time the item is added
return [...prev, { ...clickedItem, amount: 1 }];
});
};
react typescript onclick type
interface IProps_Square {
message: string;
onClick: React.MouseEventHandler<HTMLButtonElement>;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us