mirror of
https://github.com/sigmasternchen/x86-64-wordle
synced 2025-03-15 08:09:01 +00:00
fix: missing keys in react array
This commit is contained in:
parent
121866e86a
commit
7d049af52d
2 changed files with 5 additions and 3 deletions
|
@ -10,10 +10,11 @@ export const Field = ({size, fieldData}) => {
|
||||||
range(size[1]).map(y =>
|
range(size[1]).map(y =>
|
||||||
range(size[0]).map(x => (
|
range(size[0]).map(x => (
|
||||||
<Cell
|
<Cell
|
||||||
|
key={x + "-" + "y"}
|
||||||
state={fieldData?.[y]?.[x]?.state ?? CellState.Empty}
|
state={fieldData?.[y]?.[x]?.state ?? CellState.Empty}
|
||||||
content={fieldData?.[y]?.[x]?.content ?? " "}
|
content={fieldData?.[y]?.[x]?.content ?? " "}
|
||||||
/>
|
/>
|
||||||
)).concat([<br />])
|
)).concat([<br key={y + "br"} />])
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,13 +9,14 @@ export const Keyboard = ({used, onKey}) => {
|
||||||
"ENTER", "Z", "X", "C", "V", "B", "N", "M", "BACK"
|
"ENTER", "Z", "X", "C", "V", "B", "N", "M", "BACK"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
let newlineCounter = 0;
|
||||||
return <div className="keyboard">
|
return <div className="keyboard">
|
||||||
{
|
{
|
||||||
keys.map((key) => {
|
keys.map((key) => {
|
||||||
if (key) {
|
if (key) {
|
||||||
return <Key onKey={onKey} state={used[key] ?? CellState.Unknown} content={key} />;
|
return <Key key={key} onKey={onKey} state={used[key] ?? CellState.Unknown} content={key} />;
|
||||||
} else {
|
} else {
|
||||||
return <br />
|
return <br key={"br-" + newlineCounter++} />
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue