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