Skip to content

Commit

Permalink
Module 3
Browse files Browse the repository at this point in the history
  • Loading branch information
d-levin committed Sep 7, 2017
1 parent 2ee6de2 commit eb2be9a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion 3-render-function/3.3-higher-order-component.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,22 @@
}

function withAvatarURL (InnerComponent) {
// Implement this!
return {
props: {
username: String
},
data () {
return {
url: 'http://via.placeholder.com/200x200'
}
},
created () {
fetchURL(this.username, (url) => { this.url = url })
},
render (h) {
return h(InnerComponent, { props: { src: this.url } })
}
}
}

const SmartAvatar = withAvatarURL(Avatar)
Expand Down

0 comments on commit eb2be9a

Please sign in to comment.