You can pass parent props to both component.
For example :
class Parent {
state = {
fieldFocus: false
}
handleFocus = () => {
this.setState({ focus: true });
}
render() {
const { focus } = this.state;
return (
<>
<component1 handleFocus={this.handleFocus} />
<component2 isFocus={focus} />
</>
)
}
}
And in Component 1 :
class Component1 {
render() {
const { handleChange } = this.props;
return <button onClick={handleChange} />
}
}
Then in component2 you will be able to access isFocus props from parent and set it focused.
EDIT
In component2 :
class Component1 {
render() {
const { isFocus } = this.props;
return <input isFocus={isFocus} />
}
}
then edit style depending on boolean isFocus