Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

144
Vistas
Add export default to this code because it showing error in my app component

I have tried const DataList = () => { at the beginning and ending but it wasn't working

Add export default to this code because it shows an error in my app component

    import { render } from '@testing-library/react'
            import React,{useState} from 'react'
            import ReactDOM from 'react-dom/client';
            const Thingy = ({...props}) => {
              const [userInput, setUserInput] = useState('');
              const [showResult, setShowResult] = useState(false);
              const handleChange = ev => (setUserInput(ev.target.value), setShowResult(false));
              const convertChar = ch => {
                const c = ch.toLowerCase();
               
                if ('0' <= c && c <= '9') return ch.toString();
                if (!('a' <= c && c <= 'z')) return ch;         
                return c.charCodeAt(0) - 'a'.charCodeAt(0) + 1;
              };
              const transformInput = () => userInput
                .split('')                    letters
                .map(c => convertChar(c))     
                .join(' '); 
        getResult = () => userInput
                .split('')                  
                .map(c => convertChar(c))  
                .filter(                    
                  c => (
                    typeof c !== 'string' &&    
                    !isNaN(c)                   
                  )
                )
                .reduce(                   
                  (total, itm) => total + itm, 0
                );
              return (
                <div>
                  <div>
                    <label htmlFor={'usrinp'}>Enter text: </label>
                    <input
                      id="usrinp"
                      value={userInput}
                      onChange={handleChange}
                    />
                  </div>
                  {
                    userInput.length > 0 &&
                    <p>Converted text to: {transformInput()}</p>
                  }
                  <button onClick={() => setShowResult(true)}>
                    Submit
                  </button>
                  {
                    showResult && <p>Result is: {getResult()}</p>
                  }
                </div>
              );
            };
            
            ReactDOM.render(
              <div>
                <h4>Transform User input text to numbers</h4>
                <Thingy />
              </div>,
              document.getElementById("rd")
            );
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda