Use input fields to calculate value and send output

https://separate-emerald-termite.builder.live/percent-change-calculator

API KEY a39605be625942618b4bb1991667abc2

I want to use the input fields to calculate an output just like this: Percentage Change Calculator

Gatsby only at this point…

I’m still a bit of a newb when it comes to JS. I’m stuck at using an action to save the input value to a state instead of using a True / False. Is this right? Do I have to use custom code to accomplish what I am looking to do?

Basically, once someone changes the second number I want the “Change” output value to update to the calculated number.

In my limited knowledge, it would look something like this:
var startnumber = startnumberinputvalue
var endnumber = endnumberinputvalue
var output = endnumber-startnumber

The values would update based on what is entered into the input field. Update the var’s on change.