ReactJS-在材质UI中的AppBar内自动完成

ReactJS-在材质UI中的AppBar内自动完成,reactjs,autocomplete,material-ui,Reactjs,Autocomplete,Material Ui,我正在学习ReactJS,我构建了一个AppBar,并在其中添加了一个TextField。它工作得很好。以下是我的代码: class Test extends React.Component { render() { return ( <MuiThemeProvider> <AppBar title={"Benchmarking"} iconElementLeft={<IconButton iconClass

我正在学习ReactJS,我构建了一个
AppBar
,并在其中添加了一个
TextField
。它工作得很好。以下是我的代码:

class Test extends React.Component {  
render() {
    return (
    <MuiThemeProvider>
      <AppBar
        title={"Benchmarking"}
        iconElementLeft={<IconButton iconClassName="muidocs-icon-custom-github" />}
        iconElementRight={
          <div>
            <TextField
                hintText='this is a sample text'
            />
          </div>
        }
      />

      </MuiThemeProvider>
    )
  }
}
类测试扩展了React.Component{
render(){
返回(
)
}
}

现在我尝试在
文本字段
的位置添加一个
自动字段
,它不会引发任何错误,但是
应用程序栏
不会显示。有什么问题吗?请提供帮助。

自动完成
需要
数据源
onUpdateInput
道具,因此您必须提供这些道具。做这样的事

 state = {
    dataSource: [],
  };

  handleUpdateInput = (value) => {
    this.setState({
      dataSource: [
        value,
        value + value,
        value + value + value,
      ],
    });
  };
然后在
AutoComplete

  <AutoComplete
          hintText="Type anything"
          dataSource={this.state.dataSource}
          onUpdateInput={this.handleUpdateInput}
        />

我的坏消息。我无法尝试使用状态参数。谢谢。