Skip to content

Simple decorator to provide the context in the functional style

License

Notifications You must be signed in to change notification settings

galkinrost/react-contextify

Repository files navigation

React contextify Build Status

High order component to provide the context in the functional style

Installation

npm install --save react-contextify

Usage

import React, {PropTypes} from 'react'
import contextify from 'react-contextify'

const ContextProvider = () => (...)

export default contextify({
    foo: PropTypes.string
}, props => ({
    foo: props.bar
}))(ContextProvider)


...

const ContextHandler = (_, context) => (...)

ContextHandler.contextTypes = {
    foo: PropTypes.string
}

...
<ContextProvider bar="baz">
...
    <ContextHandler />
...
</ContextProvider>

License

MIT

About

Simple decorator to provide the context in the functional style

Resources

License

Stars

Watchers

Forks

Packages

No packages published