我基本上需要将一个值传递给我的 Web 组件,然后我将对其执行一些随机操作,现在我想将该新值传递回我的 React 组件。我怎么做?
function MyReactcomp() {
const [state, setState] = useState("Justin is cool");
return (
<div className="Wrapper">
<customweb-component state={state} />
</div>
);
}
Run Code Online (Sandbox Code Playgroud)
现在在自定义网络组件中,我将状态更改为“不,你不!!”。如何将此值从我的 Web 组件传递回我的 Rea t 组件?我知道我可以向下传递函数,因为你只能向下传递字符串