Use a consumer for identity
parent
f59ef50299
commit
5c5d81cf26
@ -0,0 +1,16 @@
|
||||
import PropTypes from 'prop-types';
|
||||
import { PureComponent } from 'react';
|
||||
|
||||
export class IdentityConsumer extends PureComponent {
|
||||
static contextTypes = {
|
||||
identity: PropTypes.object
|
||||
};
|
||||
|
||||
static propTypes = {
|
||||
children: PropTypes.func.isRequired
|
||||
};
|
||||
|
||||
render() {
|
||||
return this.props.children(this.context.identity);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue