Skip to content

Instantly share code, notes, and snippets.

View starkraving's full-sized avatar

Mike Ritchie starkraving

View GitHub Profile
@etienne-dldc
etienne-dldc / combineContext.js
Created March 28, 2018 18:38
A small function to combine react Contexts.
import React from 'react';
function onlyChild(children) {
return Array.isArray(children) ? children[0] : children;
}
export function combineContext(contexts) {
class Provider extends React.Component {
render() {
const init = this.props.children;