Skip to content

Instantly share code, notes, and snippets.

@danielnmai
Created September 8, 2018 16:45
Show Gist options
  • Save danielnmai/c2df9e78bbe729ffdfa04c4d8be8c68a to your computer and use it in GitHub Desktop.
Save danielnmai/c2df9e78bbe729ffdfa04c4d8be8c68a to your computer and use it in GitHub Desktop.
Context Provider for App.js
import React from 'react';
import PropTypes from 'prop-types'
import App from './App'
class ContextProvider extends React.Component {
static childContextTypes = {
insertCss: PropTypes.func,
}
getChildContext() {
return { ...this.props.context }
}
render () {
return <App { ...this.props } />
}
}
export default ContextProvider
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment