import React from 'react'
function subValues() {
let num1, num2, res;
num1 = Number(document.sub.txtnum1.value)
num2 = Number(document.sub.txtnum2.value)
res = num1 - num2;
document.sub.txtres.value=res
}
function Sub() {
return (
<div>
<form>
First number:<input type="number" className="txtNum1"></input>
Second number:<input type="number" className="txtNum2"></input>
Result: <input className="textres"></input>
<input type="button" value="Calculate" onClick="subValues()" ></input>
</form>
</div>
)
}
export {
Sub,
subValues
}
I am trying to export both of these functions. I am learning how to use React Router right now and trying to create a very basic calculator with a Single Page Application. It does not like it when I try to put the subValues function inside of the Sub function. I have tried different ways to export that was shown in exporting multiple modules in react.js this thread, but it did not like it when I tried those ways at all. What is the correct way to get both of these to export and be usable with my App component? Thank you so much.
p.s. I do know that the code that I have written up right here will probably not work and is probably wildly wrong. I just typed all of this up and am trying to get to be able to test my code but can't until I can use both functions