我下面有2个类似代码的组件
//component A
const A = () => {
const [comA, setComA] = useState("1");
render()
}
export default A;
//component B
const B = () => {
render(<Button onclick={() => someThing }>
</Button>
)
}
export default B;
如何从组件B的comA
更新组件A
的状态Button
?