keep to conventions if it is onClick just call it onClick not callback

This commit is contained in:
edwardbrodski 2023-09-21 23:11:09 +01:00
parent c86cd7b6e3
commit 6e479ea745

View File

@ -104,7 +104,7 @@ function TicTacToe() {
const callback = () => {
playTurn(index);
};
return <TicTacToeCell state={gridState[index]} callback={callback} />;
return <TicTacToeCell state={gridState[index]} onClick={callback} />;
})}
</div>
</div>
@ -113,19 +113,12 @@ function TicTacToe() {
interface CellProps {
state: number;
callback: () => void;
onClick: () => void;
}
function TicTacToeCell({ state, callback }: CellProps) {
function handleClick() {
callback();
}
function TicTacToeCell({ state, onClick }: CellProps) {
return (
<div
className={`TicTacToeCell ${getStateClass(state)}`}
onClick={handleClick}
>
<div className={`TicTacToeCell ${getStateClass(state)}`} onClick={onClick}>
<p>{getStateChar(state)}</p>
</div>
);