Package Exports
- react-utils
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-utils) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
React Utils
React: useful utils and mixins (WindowSizeWatch, ViewportWatch, ...)
Installation
Run npm install react-utils --save
Usage
##Mixins## Useful mixins which can help you to build your components more quick and clean.
####WindowSizeWatch####
var React = require('react');
var ReactUtils = require('react-utils');
module.exports = React.createClass({displayName: 'MyComponent1',
mixins: [ReactUtils.Mixins.WindowSizeWatch],
// ...
onWindowResize: function (event) {
console.log(event.width, event.height);
},
});####ViewportWatch####
var React = require('react');
var ReactUtils = require('react-utils');
module.exports = React.createClass({displayName: 'MyComponent1',
mixins: [ReactUtils.Mixins.ViewportWatch],
// ...
onViewportChange: function (viewport) {
console.log(viewport.scrollLeft, viewport.scrollTop);
console.log(viewport.innerWidth, viewport.innerHeight);
console.log(viewport.outerWidth, viewport.outerHeight);
},
});