plougsgaard / react-timeout

Component wrapper for setTimeout et al that cleans up after itself.
127 stars 17 forks source link

Allow access to the wrapped instance through `component.wrappedInstance` #29

Closed peterkhayes closed 6 years ago

peterkhayes commented 6 years ago

This is important if you want to access instance methods on a component which is wrapped by ReactTimeout. As an example, imagine you have an input component that needs to use ReactTimeout, but you also want to be able to focus the input.

The interface is similar to react-redux - see: https://github.com/reactjs/react-redux/blob/fd436b1e024c4194d3f44dfcef8e30fd24a99a1a/src/components/connectAdvanced.js#:181

Test plan: Added a unit test.

plougsgaard commented 6 years ago

Seems good, I'll look at it in a bit!