How to set focus to next input on enter key press in use ref hook in material ui text field

Create an array of refs

import React, {useState, useRef} from 'react';
export default function App() {
const inputRefs = useRef([]);
}

Creating empty array with the length of 10

length = 10;
import React, {useState, useRef} from 'react';
export default function App() {
const inputRefs = useRef([]);
const [data] = useState(...Array(length).keys());
}



Source Medium

Visit Medium For Full Source

Comments

Popular posts from this blog

String Encoding and Decoding in Python

Python secrets module - Token Generator