Created
February 4, 2016 22:32
-
-
Save eltonjuan/f2cb51d3f62d994a55cf to your computer and use it in GitHub Desktop.
LOL
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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
// TODO remove relative path madness | |
import FavoritesStarButton from './FavoritesStarButtonReact'; | |
const JunoFavoritesStarButton = { | |
is: 'view/components/favoritesstarbutton/FavoritesStarButton', | |
defaults() { | |
return { | |
props: { | |
product: '', | |
isFavorite: false, | |
}, | |
reactNode: <FavoritesStarButton isFavorite={this.isFavorite} product={this.product} />, | |
}; | |
}, | |
postRender() { | |
ReactDOM.render( | |
React.cloneElement(this.reactNode, { | |
product: this.product, | |
isFavorite: this.isFavorite, | |
}), | |
this.el | |
); | |
}, | |
postUpdate() { | |
ReactDOM.render( | |
React.cloneElement(this.reactNode, { | |
product: this.product, | |
isFavorite: this.isFavorite, | |
}), | |
this.el | |
); | |
}, | |
preDestroy() { | |
ReactDOM.unmountComponentAtNode(this.el); | |
}, | |
}; | |
export default juno.ViewComponent.extend(JunoFavoritesStarButton); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment