SHARE
TWEET

Untitled

a guest Jul 22nd, 2019 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { useState } from "react";
  2. import ReactDOM from "react-dom";
  3.  
  4. function App() {
  5.   console.log("render");
  6.   let [val, setVal] = useState(0);
  7.   return <button onClick={() => setVal(1)}><Child/></button>;
  8. }
  9.  
  10. function Child() {
  11.   console.log('render the child')
  12.   return <span>go</span>
  13. }
  14.  
  15. const rootElement = document.getElementById("root");
  16. ReactDOM.render(<App />, rootElement);
  17.      
  18. render
  19. render the child
  20. render
  21. render the child
  22. render
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top