Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. // Set of possible check box values ( file: person.jsx )
  2. Domain=[
  3. { id:0, name:"apple", value:"Apple" },
  4. { id:1, name:"orange", value:"Orange" },
  5. { id:2, name:"banana", value:"Banana" },
  6. { id:3, name:"rGrape", value:"Red grapes" },
  7. { id:4, name:"gGrape", value:"Green grapes" },
  8. ]
  9.  
  10.  
  11. // a single user's preferences ( file: person.jsx )
  12. state={
  13. userid:0,
  14. name:"Tom",
  15. gender:"Male",
  16. age:20,
  17. fruits:["apple", "rGrape"]
  18. }
  19.  
  20. // ( file: person.jsx , inside render() )
  21. {
  22. this.Domain.map(
  23. (fruit, index) => (
  24. //console.log();
  25. <p>
  26. <li key={fruit.id}>
  27. <input type="checkbox"
  28. defaultChecked=
  29. { //false //if set to false all unchecked
  30. this.state.fruits.map(
  31. (stateFruit) =>(
  32. if(val.name === stateSym)
  33. return true;
  34. else
  35. console.log(false);
  36. console.log(fruit.name === stateFruit)
  37. )
  38. )
  39. }
  40. onChange={this.handleChangeChk} /> {fruit.value}
  41. </li>
  42. </p>
  43. )
  44. )
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement