I´m creating a Bingo board and I need that the one in the middle always stays the same even when shuffleing this array:
const bbb = [
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
" ",
"",
"",
"",
"",
"",
" ",
" ",
"",
"",
"",
"",
" ",
"",
""
];
const data = arrayShuffle(bbb).reduce(
(data, value, index) => ({ ...data, [index]: value }),
{}
);
and then Im maping the array to display the Tiles and create the board like this:
{Object.keys(data).map(id => (
<Tile
key={id}
id={id}
isSet={state.checked[id]}
onToggle={() => toggle(id)}
>
{data[id]}
</Tile>
))}