Skip to content

Instantly share code, notes, and snippets.

View DaneSirois's full-sized avatar

Dane Sirois DaneSirois

View GitHub Profile
@DaneSirois
DaneSirois / typescript-implicit-types-1.ts
Created February 27, 2019 19:11
TypeScript - implicit variable typing
let myString = 'hello world'; // implicitly types variable as type 'string'
myString = 52;
//$ error: Type '52' is not assignable to type 'string'
@DaneSirois
DaneSirois / compound_components-ex.5.js
Last active September 18, 2018 17:13
Compound Components - ex.5
<ShoppingCart direction='vertical' onClick={this.handleItemClick}>
<ShoppingCartItem>Eggs</ShoppingCartItem>
<ShoppingCartItem>Ham</ShoppingCartItem>
<ShoppingCartExpandableItem extendedDetails='Details to show when clicked'>
Bread
</ShoppingCartExpandableItem>
</ShoppingCart>
@DaneSirois
DaneSirois / compound_components-ex.4.js
Last active September 18, 2018 17:01
Compound Components - ex.4
<ShoppingCart direction='vertical' onClick={this.handleItemClick}>
<ShoppingCartItem>Eggs</ShoppingCartItem>
<ShoppingCartItem onClick={this.otherClickHandler}>
Ham
</ShoppingCartItem>
</ShoppingCart>
@DaneSirois
DaneSirois / compound_components-ex.3.js
Last active September 17, 2018 23:21
Compound Components - ex.3
<ShoppingCart direction='vertical' onClick={this.handleItemClick}>
<ShoppingCartItem>Eggs</ShoppingCartItem>
<ShoppingCartItem>Ham</ShoppingCartItem>
</ShoppingCart>
@DaneSirois
DaneSirois / compound_components-ex.1.js
Last active September 18, 2018 17:00
Compound Components - ex.1
<ShoppingCart
direction='vertical'
items={[
{ name: 'Eggs' },
{ name: 'Ham' }
]}
onItemClick={this.handleItemClick}
/>
store.dispatch({
type: 'CHANGE_THEME',
payload: localStorage.getItem('theme') || 'dark'
});