Mern problem in displaying data


I am facing a problem in mern stack. I cannot make a crud application. i have done redux here too.
i can add item, but that item is not showing actually.

in add item i did this in action in redux

export const addItem = (item) => dispatch =>{'/api/profile/add',item)

in fetching item i used.

export const getItems = () => dispatch =>{

in item list where items will be seen react js

              <div key={_id}>
                 <button className="btn btn-success btn-sm" onClick={this.onDeleteClick.bind(this, _id)}>Delete</button>

please help me how to fix it.

Use and post your code there.

i have uploaded in github. please see

i want if i add something then the item will be shown, and this is protected only.

I took a quick look and couple of things I notice is that add profile on backend doesn’t match Profile schema and on the frontend you have item when it’s items in your redux store.

1 Like

yes in models in gave profile, but in redux i gave item because there is only one input field. where u seeing problem can u specify ?

On the server in routes/api/profile.js you use title when your schema requires item.

In redux store you have key items (plural), but in ItemList.js you mapStateToProps using item (singular).