So I have the following code that shuffles an array and returns a pair of words
const words =
[ 'monitor', 'program', 'application', 'keyboard'
, 'javascript', 'gaming', 'network'
]
for (let i = words.length; --i;) // shuffle Array
{
let j = Math.floor(Math.random() * (i + 1));
[words[i], words[j]] = [words[j], words[i]]
}
// get 2 random words
console.log( words[0], words[1] )
I want to return each word in its own button like the following picture:
Each time a button is selected with an onClick I want the page to rerender with a new set of questions. How can I do this in React?
