내가이 상황에서 내 자식 요소의 상태를 얻을 수있는 방법을 알고 싶습니다하시기 바랍니다ReactJS에서 내 자식 요소의 상태를 어떻게 얻을 수 있습니까?
class Child extends React.Component{
constructor(props){
super(props)
this.state = {
element : "I NEED THIS STATE"
}
}
render(){
return <h1>Hello</h1>
}
}
class Main extends React.Component{
render(){
return(
<div>
<Child />
</div>
)
}
}
이유를 자세히 설명해주세요. 전반적으로 달성하려는 것은 무엇입니까? –