I need to set component dimensions depending on parent element. Is it possible to get width and height of parent by ref from virtualDOM before it renders?
Parent
export default class App extends React.Component {
render() {
return (
<div>
<div className={'avocado-container'} ref={(container) => { this.container = container; }}>
<Resizer parent={this} scrollAxis={'y'}>
</Resizer>
</div>
</div>
);
}
}
I need to get the dimensions in constructor of child.
Is is possible with something like this.refs.container.offsetWidth
?