Created
May 19, 2016 14:53
-
-
Save goldhand/2c1af2651f79f3b8953054b46307348f to your computer and use it in GitHub Desktop.
An idea for loading large image files. Shouldn't update the state in componentDidMount though. Worried loading the white bg then loading another image right away will lead to thrashing
This file contains hidden or 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
// currentBG = 'data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs='; // single white pixel | |
componentDidMount() { | |
// set background image after compnent has been built | |
this.setState({ | |
...this.state, | |
styles: { | |
...this.state.styles, | |
backgroundImage: `url(${this.props.background})`, | |
}, | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment