-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b03c5b
commit 4f2bbb6
Showing
4 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { h } from 'preact'; | ||
|
||
export const applyHOC = (Component) => (props) => <Component {...props} HOCApplied={true} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { h } from 'preact' | ||
import Item from './listItem.jsx' | ||
|
||
const items = [0, 1, 2, 3] | ||
|
||
export const List = () => { | ||
return <div id="item-list">{items.map(item => <Item key={`item-${item}`} index={item}/>)}</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { h, Component } from 'preact' | ||
import { applyHOC } from './hoc.jsx' | ||
|
||
class ListItem extends Component { | ||
render() { | ||
return <div>item {this.props.index}</div> | ||
} | ||
} | ||
|
||
const WrappedListItem = applyHOC(ListItem) | ||
|
||
export default WrappedListItem |