Reputation:
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
Upvotes: 1
Views: 67
Reputation: 108
do
const individual = props.individuals.map(person=>....
or
const DarkMode = ({individuals}) =>{
const individual = individuals.map(person=>....
Upvotes: 0
Reputation: 378
You have to write this props.individuals.map
instead of props.map
Upvotes: 0
Reputation: 1436
props
is an object. map
is a method of an array. You probably meant props.individuals.map
Upvotes: 2