Skip to content

xuquantong/learn-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started with Create React App

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

yarn start

目录

  1. 父子组件之间传递数据(branch tabcontrol)
  • 父传子
    • 父组件通过属性=值的方式传递给子组件数据
    • 子组件通过props参数获取父组件传递过来的数据
  • 子传父
    • 和父传子一样,也是通过props传递数据,只不过是让父组件给子组件传递一个回调函数,在子组件中调用这个函数即可
  1. 模拟Vue中的slot 虽然React中没有Vue的插槽,但可以实现类似功能,根本原理就是jsx可以当成参数传递给组件;
  • 可以将jsx放在元素内部,子组件可通过props.children获取
  • 也可以将jsx放在属性中传递给子组件

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published