-
-
Save Rogdham/1a19d9871612bf7145f92cb62138e8fc to your computer and use it in GitHub Desktop.
Reproducible Demo for https://github.com/facebook/create-react-app/issues/6399
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"; | |
class App extends Component { | |
state = { height: "*loading*" }; | |
componentDidMount() { | |
this.setState({ | |
height: this.wrapper.offsetHeight | |
}); | |
} | |
render() { | |
return ( | |
<div | |
ref={obj => { | |
this.wrapper = obj; | |
}} | |
> | |
My height is {this.state.height} | |
</div> | |
); | |
} | |
} | |
export default App; |
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
html, body { | |
height: 100%; | |
margin: 0; | |
} | |
div { | |
display: block; | |
height: 100%; | |
background-color: red; | |
} |
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 from 'react'; | |
import ReactDOM from 'react-dom'; | |
import App from './App'; | |
import './index.css' | |
ReactDOM.render(<App />, document.getElementById('root')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment