Is it possible to focus div (or any other elements) using the focus() method?
I\'ve set a tabIndex to a div element:
import React from "react"
import ReactDOM from 'react-dom';
export default class DivFocusReactJs extends React.Component {
constructor(props) {
super(props)
this.state = {
}
}
componentDidMount() {
ReactDOM.findDOMNode(this.refs.divFocus).focus();
}
render() {
return (
Focusing div elements with React
{/*your code here...*/}
)
}
}