📜  反应循环钩子以显示在其他钩子中 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:02:32.550000             🧑  作者: Mango

代码示例1
import React, { useState } from "react";

function App() {

  const [list, setList] = useState(" ");

  const [items, updateOnClick] = useState([ ]);

  function updateList(event) {
    const valueEntered = event.target.value;
    setList(valueEntered);
  }

  function updateClick(){
     updateOnClick(list);
     }
 return (
           
            
            
    {items.map(item =>
  • {item}
  • ) }
);} export default App;