Skip to content

Commit

Permalink
- Tutorial: Jogo da Velha
Browse files Browse the repository at this point in the history
 O que você está construindo?
Configuração para o tutorial
Visão geral
Construindo o tabuleiro
Passando dados por meio de adereços
Fazendo um componente interativo
Ferramentas de desenvolvedor React
  • Loading branch information
EdiJunior88 committed Sep 15, 2023
1 parent d090170 commit 2c9d4f6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 9 deletions.
20 changes: 11 additions & 9 deletions app/src/Board.jsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
import Square from "./Components/Square";

const Board = () => {
return (
<>
<div className='board-row'>
<button className='square'>1</button>
<button className='square'>2</button>
<button className='square'>3</button>
<Square />
<Square />
<Square />
</div>

<div className='board-row'>
<button className='square'>4</button>
<button className='square'>5</button>
<button className='square'>6</button>
<Square />
<Square />
<Square />
</div>

<div className='board-row'>
<button className='square'>7</button>
<button className='square'>8</button>
<button className='square'>9</button>
<Square />
<Square />
<Square />
</div>
</>
);
Expand Down
17 changes: 17 additions & 0 deletions app/src/Components/Square.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { useState } from "react";

const Square = () => {
const [value, setValue] = useState(null)

function handleClick() {
setValue('X')
}

return (
<button className='square' onClick={handleClick}>
{value}
</button>
);
};

export default Square;

0 comments on commit 2c9d4f6

Please sign in to comment.