Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidMount() {
const {focusPath, path} = this.props
if (PathUtils.hasFocus(focusPath, path)) {
this.focus()
}
}
UNSAFE_componentWillReceiveProps(nextProps: Props) {
const willHaveFocus = PathUtils.hasFocus(nextProps.focusPath, nextProps.path)
const hasFocus = PathUtils.hasFocus(this.props.focusPath, this.props.path)
if (willHaveFocus && !hasFocus) {
this.focus()
}
}
UNSAFE_componentWillReceiveProps(nextProps: Props) {
const willHaveFocus = PathUtils.hasFocus(nextProps.focusPath, nextProps.path)
const hasFocus = PathUtils.hasFocus(this.props.focusPath, this.props.path)
if (willHaveFocus && !hasFocus) {
this.focus()
}
}