Skip to content

Instantly share code, notes, and snippets.

@velotiotech
Created June 26, 2020 11: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 velotiotech/a762975f023a256ff52b6c91c24c59ad to your computer and use it in GitHub Desktop.
Save velotiotech/a762975f023a256ff52b6c91c24c59ad to your computer and use it in GitHub Desktop.
Component based MicroFrontend
class Cart extends MicroFrontend {
beforeMount() {
// get previously saved cart from backend
}
render() {
return `<!-- Page -->
<div class="page-area cart-page spad">
<div class="container">
<div class="cart-table">
<table>
<thead>
.....
`
}
addItemToCart(){
...
}
deleteItemFromCart () {
...
}
applyCouponToCart() {
...
}
onDismount() {
// save Cart for the user to get back to afterwards
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment