So I have this “Get A Quote” button and whenever it’s clicked I’m setting a new state so the current quote and author in the html would change. Here’s some of my code regarding to how I’m changing the state:
state = {
quote: 'No matter what you’re going through,
there’s a light at the end of the tunnel..',
author: 'Demi Lovato'
}
That is at a root level. It is run once and stores a number in that variable. The right side of that equation doesn’t get rerun every time that variable is accessed. That value will never change. You need to put that somewhere where it will get reevaluated every time you need a new quote.
When I fix those two things, I get a button that will give me a new quote on each press.