From cbe3a009e7e9119ce12a77b307ec2f9c9395773e Mon Sep 17 00:00:00 2001 From: Qing Date: Tue, 12 Mar 2024 13:35:08 +0800 Subject: [PATCH] init --- src/pages/HocPage.js | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/pages/HocPage.js diff --git a/src/pages/HocPage.js b/src/pages/HocPage.js new file mode 100644 index 0000000..13fd410 --- /dev/null +++ b/src/pages/HocPage.js @@ -0,0 +1,39 @@ +/** + * 高阶组件 + */ +import React, {Component} from 'react'; +// function Child(props) { +// return
Child
+// } + +const foo = Cmp => props => { + return ( +
+ +
+ ) +}; +// const Foo=foo(Child); +class HocPage extends Component { + render() { + return ( +
+

HocPage

+ +
+ ); + } +} + +@foo +class Child extends Component { + render() { + return ( +
+

Child

+
+ ); + } +} + +export default HocPage; \ No newline at end of file