Skip to content

Instantly share code, notes, and snippets.

View yushanwebdev's full-sized avatar
🇱🇰
Sri Lankan Coder

Yushan Fernando yushanwebdev

🇱🇰
Sri Lankan Coder
View GitHub Profile
import React, { useRef } from "react";
const CustomTextInput = () => {
const textInput = useRef();
focusTextInput = () => textInput.current.focus();
return (
<>
<input type="text" ref={textInput} />
import React, { Component, createRef } from "react";
class CustomTextInput extends Component {
textInput = createRef();
focusTextInput = () => this.textInput.current.focus();
render() {
return (
<>