just a curious question, if i have something like this:
const Parent= () => {
const info = `hey show this ${state}` //how can i get this state from child?
return <div>
<Child />
<iframe
srcDoc={info}
width="100%"
height="100%"
/>
</div>
}
export default Parent
const Child= () => {
const [state, setstate] = useState("");
const onclick =()=>{setstate('state from child')}
return <div>
<button onClick={onclick}>click!</button>
<p>I am a {state}</p>
</div>
}
export default Child
how can i get this state from child?