Last active
November 22, 2016 15:11
-
-
Save vnglst/76274ad5e62382ce6a987323a8d10577 to your computer and use it in GitHub Desktop.
ReactCasts #1
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
import React, { Component } from 'react'; | |
// Returns an empty "loader" div if empty, | |
// Return unchanged WrappedComponent if not empty | |
const LoaderHOC = (WrappedComponent) => { | |
return class LoaderOC extends Component { | |
render() { | |
return (!this.props.question) | |
? <div className='loading'></div> | |
: <WrappedComponent {...this.props} /> | |
} | |
} | |
} | |
export default LoaderHOC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment