Answers for "textfield number mui settext from params"

0

textfield number mui settext from params

const textFieldRefNumber = useRef();
  const [quantity, setQuantity] = React.useState("");
     const location = useLocation();
	 if (typeof location.state !== "undefined") {
        const params = location.state.item;
      textFieldRefNumber.current.value = params.quantity;
     }

  const handleChangeQuantity = (event) => {
    setQuantity(event.target.value);
  };
  <TextField
          inputRef={textFieldRefNumber}
          required
          id="outlined-required"
          label="number"
          defaultValue={quantity}
          onChange={handleChangeQuantity}
          fullWidth
          inputProps={{ min: 0, max: 10000 }}
          type={"number"}
          InputLabelProps={{ shrink: true }}
        />
Posted by: Guest on October-19-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language