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