import DefaultColor from './DefaultColor'; function App() { colorData = [{color: "black",background: "black"},{color: "mint", background:"#2CB695"}]; const afterClick = (e) =>{ setBody(e.target.id) } const [body, setBody] = useState("Black") return ( <> <div className="container"> <DefaultColor props={body}/> </div> <div className="container-car"> {ColorsData.map((color,background) =>{ return( <div className="card-car"> <div className="box-car" key={color.color + body} id={color.color} onClick={afterClick} style={{background : color.background}}> </div> <p>{color.color}</p> </div> ) })} </div> </div> </> ``` ```code function DefaultColor(props) { return ( <> <div className="default-container"> <img src="./images/abc-{body}.png"/> </div> </> ) } export default DefaultColor
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)