Guest User

Untitled

a guest
Dec 17th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. import React from 'react';
  2. import ReactDom from 'react-dom';
  3.  
  4. const totalColor=40;
  5. const Box=(props)=>{...}
  6.  
  7. class RandomColorApp extends React.Component{
  8. constructor(props){
  9. super(props);
  10. const boxes = new Array(totalColor).fill().map(this.randomColor,this);
  11. this.state={boxes}
  12.  
  13. setInterval(()=>{
  14.  
  15. const randomIndex1=Math.floor(Math.random()*3)
  16. const randomIndex2=Math.floor(Math.random()*3)
  17. if(randomIndex1!==randomIndex2){
  18. console.log(randomIndex1,randomIndex2)
  19. }
  20. },1000);
  21. }
  22.  
  23. randomColor(){...}
  24. render(){...}
  25.  
  26. }
  27.  
  28. RandomColorApp.defaultProps={colors:[...]}
  29.  
  30. ReactDom.render(<RandomColorApp/>,document.getElementById('app'));
Add Comment
Please, Sign In to add comment