function App() {
const puzzles = [...Array(12)].map((_, i) => i).sort(() => Math.random() - 0.5);
console.log(puzzles)
return (
<Game puzzles={puzzles} />
);
}
const Game = (props) => {
return <div>{props.puzzles}</div>;
};
I set a const rand array [puzzles] from 0 to 2 at App.js
then I pass the [puzzles] variable to the Game Component,
I console.log the [puzzles] at App.js and Game Component,
somehow the results are different.....
[1,2,0] log in App.js
[0,2,1] log in Component
It seen like the array is running again somewhere inside the JSX,
Can someone tell me if I missed anything? Many thanks!!!