Skip to content

Instantly share code, notes, and snippets.

View mikeLspohn's full-sized avatar

Michael Spohn mikeLspohn

View GitHub Profile
@mikeLspohn
mikeLspohn / react-16.3.2-example.js
Created April 23, 2018 03:40
React 16.3.2 New Examples
// context
const UserContext = React.createContext({}) // {} is default value
// imagine this being a deeper child
const Page = props => <ContextProvider.Consumer>
{(user) => <p>{user.name}</p>}
</ContextProvider.Consumer>
class App extends Component {
@mikeLspohn
mikeLspohn / test-factories.js
Created February 17, 2017 20:53
Javascript Factories for Tests
const item = {
type: 'something',
age: 23,
person: {
name: 'Michael'
}
}
const createItem = params => ({...item, ...params})