user13824605
user13824605

Reputation:

i have run into this error "props map error "

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

Upvotes: 1

Views: 67

Answers (3)

SHARAD
SHARAD

Reputation: 108

do

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

or

const DarkMode = ({individuals}) =>{
    const individual = individuals.map(person=>....

Upvotes: 0

Jay Parmar
Jay Parmar

Reputation: 378

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

Upvotes: 0

Piotrek
Piotrek

Reputation: 1436

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

Upvotes: 2

Related Questions