Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Spohn mikeLspohn

View GitHub Profile
@mikeLspohn
mikeLspohn / react-16.3.2-example.js
Created Apr 23, 2018
React 16.3.2 New Examples
View react-16.3.2-example.js
// 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 Feb 17, 2017
Javascript Factories for Tests
View test-factories.js
const item = {
type: 'something',
age: 23,
person: {
name: 'Michael'
}
}
const createItem = params => ({...item, ...params})