📌  相关文章
📜  反应钩子示例 - Javascript 代码示例

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

代码示例3
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;