📜  自动完成反应 - Javascript 代码示例

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

代码示例3
import React, { useState } from 'react';
using useState:

   const [val,setVal]=useState({})
changin value on click of button

  const handleClick = () => {
    setVal(top100Films[0]);//you pass any value from the array of top100Films
   // set value in TextField from dropdown list
 };
and pass this value to component in render

  option.title}
    style={{ width: 300 }}
    renderInput={params => (
      
    )}
  />