I have a mongoose schema that looks like this:
const productSchema = mongoose.Schema({
  title: String,
  type: String,
  allStock: Number,
  inStock: Number,
  img: String,
  desc: String,
  child: [{
    uid: Number,
    rented: {
      type: Boolean,
      default: false,
    },
    rentedData: {
      type: Date,
      default: new Date(),
    },
  }],
})
In my form I store the values in the state:
const [productData, setProductData] = useState({title:'',type:'',allStock:'',inStock:'',img:'',desc:''});
and then within a form set the state like so:
<input type="text" value={productData.title} onChange={(e)=> setProductData({...productData, title: e.target.value})}/>
the form has an onSubmit which then dispatches the data, I am wondering how I would create an entry for a child value would it be something like:
<input type="text" value={productData.child[{rented}]} onChange={(e)=> setProductData({...productData, child: [rented: e.target.value]})}/>
New to working with backend with react, all help welcome!
 
    