digidem / react-dimensions

[Looking for maintainers]

Home Page:http://lab.digital-democracy.org/react-dimensions/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working with redux connect

kakariko-village opened this issue · comments

Hi, i try to use react dimensions with redux but got an error:

vendor.js:151117 Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

Check the render method of DimensionsHOC.
in ConnectFunction (created by DimensionsHOC)
in div (created by DimensionsHOC)
in DimensionsHOC
in Provider

My versions:

"react-dimensions": "^1.3.0",
"react": "^16.8.6",
"redux": "^4.0.1",

My code:

....
import Dimensions from 'react-dimensions';

....

export default Dimensions({
    getHeight: function(element) {
        return window.innerHeight - 200;
    },
    getWidth: function(element) {
        let widthOffset = window.innerWidth < 1280 ? 70 : 55;
        return window.innerWidth - widthOffset;
    }
})(connect(mapStateToProps, mapDispatchToProps)(MyComponent));