'Need to display different questions on each button click in React
I need to display different questions on each button click in React Quiz app. Tried to pass state from one component to other in an array but never showed different question. New to react please help.
Code Link: https://codesandbox.io/s/pop-up-react-forked-rsypkh?file=/src/styles.css
Solution 1:[1]
I have checked your code, you can set the currentQuestion in togglescreen, and pass that to the Popup component. And render different questions based on the value of provided props
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jason |
