传入模板(children)

  1. 在组件中间写要传入的虚拟dom
  2. 在子组件中展示 {this.props.children}

比如想要传递一段代码到子组件里。

父组件Home.js:
学习记录——react传入模板(children)
子组件Children3.js:
接受父组件里的代码,使用 this.props.children
学习记录——react传入模板(children)
学习记录——react传入模板(children)

相关文章:

  • 2021-10-15
  • 2022-12-23
  • 2021-09-01
  • 2021-09-21
  • 2022-01-10
  • 2021-11-01
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-04
  • 2022-12-23
  • 2021-05-20
  • 2021-06-26
  • 2021-07-01
相关资源
相似解决方案