I'm using a texfield which clears the input text typed when enter key is pressed it triggers the onSubmit function, but for some reason when Multline is set to true, the onSubmit doesn't work.
import React, { useRef } from "react";
import "./styles.css";
import TextField from "@material-ui/core/TextField";
export default function App() {
const inputRef = useRef();
const addMessage = e => {
inputRef.current.value = "";
};
return (
<form onSubmit={addMessage}>
<TextField
// multiline="true"
inputRef={inputRef}
multiline="true"
id="filled-basic"
label="Filled"
variant="filled"
/>
</form>
);
}
I added a codesandbox as well which has the code to make it easier https://codesandbox.io/s/nifty-morning-w2gqx