【问题标题】:React - passing state value from one component to another componentReact - 将状态值从一个组件传递到另一个组件
【发布时间】:2021-01-11 11:48:00
【问题描述】:

[14

2 我有两个组件 SignIn 和 RmView(两个在不同的 js 文件中)。在登录中,我正在调用 api 并设置组件状态。我必须通过app组件将状态值传递给RmView组件。]1

this is the code of app.js here i want to get the state of sign in component and pass to rm componentm/WiQxE.png

【问题讨论】:

  • 请不要放外部链接,把相关代码sn-p贴在这里。还将数据作为道具传递给您。
  • 您的问题应该是独立的,请阅读有关如何在 StackOverflow 上提出好问题的部分。
  • 可以通过props传递数据,但是你的问题不清楚请贴出相关代码。

标签: javascript reactjs


【解决方案1】:

你的问题不清楚,没有代码真的很难帮助你,但我会说你应该实现 redux 来与你的应用程序的不同部分共享来自 api 的数据

【讨论】:

  • 这最好作为评论发布。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-03-07
  • 2020-03-12
  • 2019-12-11
  • 2018-09-28
  • 2021-01-02
  • 2022-08-17
  • 2018-11-03
相关资源
最近更新 更多