FrontendArk

Master Frontend Interviews

  • Practice
  • Playground
  • Resource
Medium

Tic-Tac-Toe

20 mins

Build a Tic-Tac-Toe game in React.

Requirements:

  1. Display a 3x3 grid for the game board.
  2. Two players take turns placing "X" and "O".
  3. Determine and display the winner when a player gets 3 in a row (horizontal, vertical, or diagonal).
  4. Allow players to restart the game after it ends.
  5. Focus on functionality over styling.
  6. The component should work out-of-the-box in a live React preview (e.g., CodeSandbox/Sandpack).

Code Editor

React Component

00:00
Loading...

Live Preview

See your React component