Skip to content

Instantly share code, notes, and snippets.

@eltonjuan
Created February 4, 2016 22:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eltonjuan/f2cb51d3f62d994a55cf to your computer and use it in GitHub Desktop.
Save eltonjuan/f2cb51d3f62d994a55cf to your computer and use it in GitHub Desktop.
LOL
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