-2
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.

0 Answers0