Display Colors

  • 1 | brown | #A52A2A
  • 2 | crimson | #DC143C
  • 3 | red | #FF0000
  • 4 | tomato | #FF6347
  • 5 | coral | #FF7F50
  • 6 | indian red | #CD5C5C
  • 7 | light coral | #F08080
  • 8 | dark salmon | #E9967A
  • 9 | orange red | #FF4500
  • How to map over the colors ?

    Posted on Mar 31, 2022

    Remember this concept,
    Start s-m-a-l-l to create something BIG

    To create a display colors component. We have to :

    • Create a state that holds the colors
    • Colors is an array of objects
    • Each color has an id , name, and hex properties
    • We loop through the colors array using the <map()> function
    • We return a <li> element for each item
    • We should provide a key for each list item
    • We assign the resulting array of elements to colorItems
    • In JSX, we include the entire colorItems array inside a <div> element, and render it to the DOM
    PreviousHomeNext
    this is counter code