Guest User

Untitled

a guest
Sep 21st, 2023
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. const App = () => {
  2.  
  3.  
  4.  
  5. let state = "fire";
  6. console.log(board_state)
  7.  
  8. return(
  9. <div className="app">
  10. <Board board_state={state} />
  11. <SideBlock board_state={state} />
  12. </div>
  13. );
  14. }
  15.  
  16. const ResetButton = (board_state) => {
  17. const [state, changeState] = React.useState();
  18. board_state = state;
  19.  
  20. const resetState = () =>{
  21. changeState("water");
  22. console.log("hello")
  23.  
  24. }
  25.  
  26.  
  27. return (<button style={{backgroundColor: "gray"}} className="resetBtn" board_state={board_state} onClick={resetState}> Reset </button>)
  28. }
  29.  
  30.  
  31. const SideBlock = ({board_state}) => {
  32. return (<div style={{marginLeft: "50px"}} className="sideBlock" board_state={board_state}>
  33. <ResetButton />
  34. </div>)
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment