我怎么能在 useState React 中发送 setStateAction

How could i send the setStateAction in useState React

const [SBMenu,setSBMenu] = useState(<MainMenu Menu={setSBMenu}/>)

我如何在 useState 中发送 setStateAction 。 我知道我们不能,但是有什么解决方案可以发送它,因为我们无法在初始化之前访问 setStateAction

不知道为什么要把一个渲染的组件设置为状态,这不是很常见。

假设你想这样做,你不能有循环逻辑

  const [a, b] = fn(c(b))

b 尚未定义。您很可能需要首先考虑代码中的 b