souporserious/react-measure

Cannot use ref within <Measure>

Closed this issue · 1 comments

Refs worked in V1, but break in V2 with React error:

Stateless function components cannot have refs.

Example:

<Measure bounds onResize={...}>
    {() => (
        <div ref='outerDiv' className={css(styles.outerDiv)}></div>
    )}
</Measure>

String refs unfortunately don't work with child functions. You can read more about them here. I'll add the same documentation here when I get a chance.