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

321
Views
How to resolve src/App.js Line 8:3: 'setColors' is not defined no-undef Line 8:17: 'colors' is not defined no-undef
import React, { useState } from 'react'
// Make sure to import the component we just built:
import './App.css';
import ColorBlock from './ColorBlock'
import ColorForm from './ColorForm'

const addColor = (newColor) => {
   setColors([...colors,newColor ])
  }

function App(){
let [colors] = useState ([
    'violet', 'blue',
    'lightblue', 'green',
    'greenyellow', 'yellow',
    'orange', 'red'
])

let colorMap = colors.map((color) => {
    return (
        <ColorBlock color={color} />
    )
})

return (
    <div className="App">
        {colorMap}
        <ColorForm addColor ={addColor}/>
        
    </div>
     )
      }

 export default App;

Compiled with problems:X

ERROR

src/App.js Line 8:3: 'setColors' is not defined no-undef Line 8:17: 'colors' is not defined no-undef

Search for the keywords to learn more about each error.

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!