SHARE
TWEET

Untitled

a guest Jun 18th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function App() {
  2.   const [numbers, setNumbers] = React.useState([0, 1, 2, 3]);
  3.   console.log("rendering...");
  4.   return (
  5.     <div className="App">
  6.       {numbers.map(number => (
  7.         <p>{number}</p>
  8.       ))}
  9.       <input
  10.         type="text"
  11.         value={numbers[0].toString()}
  12.         onChange={newText => {
  13.           let old = numbers;
  14.           old[0] = 1);
  15.           setNumbers(old);
  16.         }}
  17.       />
  18.     </div>
  19.   );
  20. }
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