keep to conventions if it is onClick just call it onClick not callback
This commit is contained in:
parent
c86cd7b6e3
commit
6e479ea745
@ -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;
|
||||
}
|
||||
|
||||
function TicTacToeCell({ state, callback }: CellProps) {
|
||||
function handleClick() {
|
||||
callback();
|
||||
onClick: () => void;
|
||||
}
|
||||
|
||||
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>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user