高阶组件其实是个函数

使用组件作为参数或者函数返回值是一个组件

高阶组件的使用:

1.定义一个函数,参数是一个组件,函数返回值是一个组件

2.@高阶组件名

  1.npm run eject

  2.npm install babel-preset-stage-2 --save-dev

  3.npm install babel-preset-react-native-stage-0 --save-dev

  4.根目录下创建.babelrc 

    {

      presets: [react-native-stage-0/decorator-support]

    }

 

相关文章:

  • 2021-12-10
  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-08
  • 2022-01-20
  • 2021-09-30
相关资源
相似解决方案