-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Théo mathieu
committed
May 2, 2016
1 parent
227f11a
commit 83d1b52
Showing
4 changed files
with
113 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* Container helper using react-meteor-data. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import Mixin from './Mixin'; | ||
|
||
export default function createContainer(options = {}, Component) { | ||
let expandedOptions = options; | ||
if (typeof options === 'function') { | ||
expandedOptions = { | ||
getMeteorData: options, | ||
}; | ||
} | ||
|
||
const { | ||
getMeteorData | ||
} = expandedOptions; | ||
|
||
return React.createClass({ | ||
displayName: 'MeteorDataContainer', | ||
mixins: [Mixin], | ||
getMeteorData() { | ||
return getMeteorData(this.props); | ||
}, | ||
render() { | ||
return <Component {...this.props} {...this.data} />; | ||
}, | ||
}); | ||
} |