There is a simple CRUD app (BE express and FE react-redux) where form values are being added to `mongodb`, schema below:

```
import mongoose from 'mongoose';

var Schema = mongoose.Schema({
  createdAt:{
    type: Date,
    default: Date.now
  },
  carNumber: { type : String , index: { unique: true }},
  carOwner: String
});

export default mongoose.model('Car', Schema);

```

`index: { unique: true }` prevents from adding same `carNumber` values by bringing [error](https://i.gyazo.com/e4b0d4d2f177cca54337b537804becb7.png) 

Cars are selected with dispatcher function in `carActions.js`:

```
//Async action
export const fetchCars = () => {
  // Returns a dispatcher function
  // that dispatches an action at later time
  return (dispatch) => {
    dispatch(fetchCarsRequest());
    // Returns a promise
    return fetch(apiUrl)
      .then(response => {
        if (response.ok) {
          response.json().then(data => {
            dispatch(fetchCarsSuccess(data.cars, data.message));
          })
        }
        else {
          response.json().then(error => {
            dispatch(fetchCarsFailed(error));
          })
        }
      })
  }
}

```

and rendered in `Cars` component:

```
render() {
    const carState = this.props.mappedCarState;
    const cars = carState.cars;
return (

<tbody>
      {cars.map((car, i) => <tr key={i}>
         <td>{car.carNumber} {car.carOwner}</td>
         <td><Button onClick={() => this.deleteCar(car)} ></Button></td>         
   </tr>)
</tbody>
}

```

I am very news to this kind of wiring, may someone suggest on how I should prevent error and return notification? 

I could miss some important information, here is [link](https://github.com/romran/crud-add-car-app) to rep.