Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

143
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!