Skip to content

Instantly share code, notes, and snippets.

@jonathanharrell
Last active July 7, 2018 20:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonathanharrell/a967fca87cbe89113bad8243f95ccf2c to your computer and use it in GitHub Desktop.
Save jonathanharrell/a967fca87cbe89113bad8243f95ccf2c to your computer and use it in GitHub Desktop.
Using ObserveDimensions React Component With Render Props
class App extends React.Component {
constructor(props) {
super(props)
}
render() {
return (
<div className="wrapper">
<ObserveDimensions
render={({width, height}) => (
<div>
Width: {width}px
Height: {height}px
</div>
)}
/>
</div>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment