why the deck is not getting re-rendered when shuffeling happens on button click.Every time I click on shuffle button the deck is displayed as it is instead of shuffled one.
const Deck = () => {
const [deck , newDeck] = useState(Card)
return (
<div>
{console.log(deck)}
<h2>Deck</h2>
<Button type="button" onClick={() =>{newDeck(deck.sort(() => Math.random() - 0.5));}}>Shuffle</Button>
{deck.map((card) => (
<p key={Math.random()}>{card.value} of {card.type}</p>
))}
</div>
);
}
export default Deck;