Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to set dynamic autocomplete with material ui

 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

 <Autocomplete
   value={val}
    options={top100Films}
    getOptionLabel={option => option.title}
    style={{ width: 300 }}
    renderInput={params => (
      <TextField
        {...params}
        label="Combo box"
        variant="outlined"
        fullWidth

      />
    )}
  />
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript modify href attr 
Javascript :: create slug in express 
Javascript :: how to add elements into an array in javascript 
Javascript :: core.js:5592 WARNING: sanitizing unsafe URL value 
Javascript :: modal example react native 
Javascript :: codeceptjs "waitForClickable" 
Javascript :: javascript to Postgress 
Javascript :: creating room in ws node js 
Javascript :: textarea events react testing library 
Javascript :: Image preload React 
Javascript :: delete an item from array javascript 
Javascript :: close button react 
Javascript :: window close function in javascript 
Javascript :: shopify api for add to cart 
Javascript :: javascript detect paste contents 
Javascript :: How to make a JSON call to an URL 
Javascript :: Change HTML Content 
Javascript :: clear inteval 
Javascript :: find all even numbers javascript 
Javascript :: The toUpperCase JavaScript string method 
Javascript :: create a javascript json object 
Javascript :: create auto increment mongodb mongoose 
Javascript :: react final form 
Javascript :: Datatable JS update chosen select in table 
Javascript :: next js generate pdf complete 
Javascript :: jest mock implementation once 
Javascript :: cogo toast react 
Javascript :: angular set attribute value dynamically 
Javascript :: convert string with dot or comma as decimal separator to number in javascript 
Javascript :: vscode format - .prettierrc jsx singleQuote not work 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =