-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathBrickProvider.js
More file actions
29 lines (25 loc) · 875 Bytes
/
BrickProvider.js
File metadata and controls
29 lines (25 loc) · 875 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import React, { Component } from 'react';
import BrickManagerContext from './BrickManagerContext';
import BrickManager from './BrickManager';
import PropTypes from 'prop-types';
class BrickProvider extends Component {
constructor(props) {
super(props);
const { store, reducer, sagaMiddleware } = this.props;
this.state = {
brickManager: new BrickManager({ store, reducer, sagaMiddleware })
};
}
render() {
const { children } = this.props;
const { brickManager } = this.state;
return <BrickManagerContext.Provider value={brickManager}>{children}</BrickManagerContext.Provider>;
}
}
BrickProvider.propTypes = {
store: PropTypes.object.isRequired,
reducer: PropTypes.func,
sagaMiddleware: PropTypes.func.isRequired,
children: PropTypes.node
};
export default BrickProvider;