我试图用下面的代码将父组件的useState值传递给几个子组件。
App.js
const [inSystem, setIn] = useState(false);
<Route exact path="/" functions={[inSystem, setIn]} component={Loading} />然后在我的loading组件中
const [inSystem, setIn] = props.functions
<NavLink to="/sol">
<button onClick={() => {setIn(true)}}>
<p >Enter System</p>
</button>
</NavLink>这是我在回答类似问题时发现的一个解决方案,我复制了我的解决方案从这个密码箱里。但是,我收到以下错误:
TypeError:未定义不可迭代(不能读取属性符号(Symbol.iterator))
我做错了什么?
https://stackoverflow.com/questions/66268804
复制相似问题