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 = () => {
|
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 handleClick() {
|
|
||||||
callback();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function TicTacToeCell({ state, onClick }: CellProps) {
|
||||||
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>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user