【问题标题】:How to get parent props from descendent component?如何从后代组件获取父道具? 【发布时间】:2020-03-26 15:53:56 【问题描述】: 我的结构如下所示。我需要从 component5 中读取 component1 的 props。怎么做?谢谢。 Component 1 |- Component 2 |- Component 4 |- Component 5 【问题讨论】: 这能回答你的问题吗? How to pass information to nested components in react? 标签: reactjs 【解决方案1】: 这里有两个主要选择: 使用context API 使用Redux 而不同的需求你可以选择Context or Redux to use 【讨论】: 【解决方案2】: 你可以在 react 或 redux 中使用上下文 上下文:https://reactjs.org/docs/context.html 还有redux库:https://redux.js.org/ 【讨论】: