Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please review this error #6

Open
piusnig opened this issue Dec 27, 2019 · 1 comment
Open

Please review this error #6

piusnig opened this issue Dec 27, 2019 · 1 comment

Comments

@piusnig
Copy link

piusnig commented Dec 27, 2019

this.props.posts.map is not a function

at this point
const postItems = this.props.posts.map(function(post) {

@Arpan90
Copy link

Arpan90 commented Aug 11, 2021

@piusnig This error is coming because in postReducers.js you probably typed:
case 'NEW_POST':
return{
...state,
items: action.payload // notice items
};

instead of:

case 'NEW_POST':
return{
...state,
item: action.payload // notice item
};

So, posts variable which is defined as an array gets replaced by an object when you create a new post.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants