KyleAMathews / React Component Width Mixin
Licence: mit
React mixin which sets width as state variable and updates as component changes shape
Stars: ✭ 29
Programming Languages
javascript
184084 projects - #8 most used programming language
react-component-width-mixin
React mixin which detects when component resizes and sets the new width as a state variable
Install
npm install react-component-width-mixin
Usage
var componentWidthMixin = require('react-component-width-mixin');
React.createClass({
mixins: [componentWidthMixin],
render: function() {
// Now the component width is available after the initial render
// as this.state.componentWidth.
}
});
If you'd like to set an initial width for your component (e.g. server-side rendering), pass in a prop called initialComponentWidth
.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].