How to clear the autocomplete's input in Material-ui after an onChange?

This page summarizes the projects mentioned and recommended in the original post on /r/codehunter

SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.
surveyjs.io
featured
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
  • material-ui

    Discontinued MUI Core (formerly Material UI) is the React UI library you always wanted. Follow your own design system, or start with Material Design. [Moved to: https://github.com/mui/material-ui] (by mui-org)

  • Reactjs In the hooks version of material UI I can't seem to be able to clear the autocomplete after an onChange event: // @flowimport React, { useRef, useState } from "react";import "./Autocomplete.scss";import AutocompleteUI from "@material-ui/lab/Autocomplete";import TextField from "@material-ui/core/TextField";function Autocomplete(props) { const { options } = props; const [value, setValue] = useState(); const container = useRef(); const input = useRef(); function onChange(event, newValue) { if (!newValue) return; props.onChange(newValue); setValue(undefined); input.current.value = ""; event.target.value = ""; } function renderInput(params) { return ( ); } return ( {value} option.title} renderInput={renderInput} value={value} onChange={onChange} /> );}export default Autocomplete; Diving into the source code I've noticed the component uses useAutocomplete hook internally. However, neither setInputValue nor resetInputValue which live internally inside that hook are exposed outside. Is there a way to accomplish an input clear after an onChange? Answer link : https://codehunter.cc/a/reactjs/how-to-clear-the-autocompletes-input-in-material-ui-after-an-onchange

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Is it possible to set up material-ui AppBar/ToolBar to have a horizontal tab menu layout?

    1 project | /r/codehunter | 12 May 2022
  • How to avoid Material UI Select focus when option is chosen?

    1 project | /r/codehunter | 9 May 2022
  • How to use TypeScript declaration files alongside JavaScript

    1 project | /r/codehunter | 30 Apr 2022
  • Fixed table header and height in Material-UI@next (v1.0.0-beta.8)

    1 project | /r/codehunter | 30 Apr 2022
  • Can't resolve 'material-ui/Button'

    1 project | /r/codehunter | 23 Apr 2022