Guest User

Untitled

a guest
May 23rd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. this.state = {
  2. name: '',
  3. subCatagory: [{ name: '', price: '', customize: [] }],
  4. };
  5.  
  6. {this.state.subCatagory.map((subCatagory, idx) => (
  7. <div className="subCatagory" key={idx}>
  8. <input
  9. type="text"
  10. placeholder={`Enter Dish #${idx + 1} name`}
  11. value={subCatagory.name}
  12. onChange={this.handlesubCatagoryNameChange(idx)}
  13. />
  14. <input
  15. type="number"
  16. placeholder={`subCatagory #${idx + 1} price`}
  17. value={subCatagory.price}
  18. onChange={this.handlesubCatagoryPriceChange(idx)}
  19. />
  20. <button
  21. type="button"
  22. onClick={this.handleRemovesubCatagory(idx)}
  23. className="small"
  24. >
  25. Delete
  26. </button>
  27. <button type="button" onClick={this.addNewCust(idx)} className="small">
  28. is cust availble?
  29. </button>
  30. {subCatagory.customize.map((customize, custIdx) => (
  31. <div key={custIdx}>
  32. <input
  33. type="text"
  34. placeholder={`subCatagory #${custIdx + 1} price`}
  35. value={customize.name}
  36. onChange={this.handlesubCatagoryChange(
  37. idx,
  38. 'customize',
  39. custIdx
  40. )}
  41. />
  42. </div>
  43. ))}
  44. </div>
  45. ))}
Add Comment
Please, Sign In to add comment