UNPKG

@khazh/tic-tac-toe-react

Version:

A customizable Tic Tac Toe game component for React with AI opponent, configurable board size, and win conditions

17 lines 524 B
import { useState } from "react"; export const useBoardSize = (initialSize = 3) => { const [boardSize, setBoardSize] = useState(initialSize); const changeBoardSize = (newSize) => { if (newSize >= 3 && newSize <= 10) { // Limit to reasonable sizes setBoardSize(newSize); } }; const getAvailableSizes = () => [3, 4, 5, 6, 7, 8, 9, 10]; return { boardSize, changeBoardSize, getAvailableSizes, }; }; //# sourceMappingURL=useBoardSize.js.map