JSFiddle - React, Tailwind, and code Playground

HTML

<div id="cajaform">
        
            <form action="" name="formularioCalc" method="post">
 
                <input type="text" name="numero" id="numer"/>
                <input type="button" name="operadorSuma" id="oSuma" value="+" onclick="calcular('suma');"/>
                <input type="button" name="operadorResta" value="-" onclick="calcular('resta');"/>
                
                <input type="text" name="result" id="resultado" readonly value="0">
                
                
                <input type="submit" value="Mandar"/>
                
                
                
            </form>
        
        
        
        </div>

JavaScript

function calcular(parametro)
        {
            
            numero = document.formularioCalc.numero.value;
            result = document.formularioCalc.resultado.value;
            if(parametro == 'suma'){
            if(result == 0){
            var resul = parseInt(numero);
                
            } else{
            var resul = parseInt(numero) + parseInt(result);
            }
            }
            if (parametro=='resta'){
                
                
               var resul= (result - numero);
                
                
            }
            
            return document.formularioCalc.resultado.value = resul;
            
            
            
        }