1

Hi everyone am still learning react by building a dark Mode toggle button that on clicked it changes the mode from light to dark and vice versa. I have ran into a problem when i tried mapping through the state and displaying the data in form of a card(incomplete though)

code structure and the errors

main app component

the Darkmode component

3 Answers3

2

props is an object. map is a method of an array. You probably meant props.individuals.map

Piotrek
  • 1,304
  • 8
  • 16
0

You have to write this props.individuals.map instead of props.map

Jay Parmar
  • 368
  • 2
  • 9
0

do

const individual = props.individuals.map(person=>....

or

const DarkMode = ({individuals}) =>{
    const individual = individuals.map(person=>....
SHARAD
  • 108
  • 10