react-refetch
react-refetch copied to clipboard
Enable standard use of the ref prop.
Instead of using a string value for the ref property, using the more modern method using the function value will enable regular use of the ref property from the parent of the wrapped component. today: https://github.com/heroku/react-refetch/blob/master/src/components/connect.js#L138 )
suggested:
This was lifted directly from react-redux during the fork. I would not be opposed to updating this, but would like to do so in a backward compatible way. It would also be nice if it could continue to work the same way as react-redux (perhaps two PRs are needed?)
so I guess we check the type of the ref prop (string/func) and act accordingly
Related: is there any good reason react-redux requires withRef: true
be set explicitly? Would it hurt anything to just make the ref always available?
I can't think of a reason why they require this...
there is one reason why you don't want withRef to always be true (or even default to true), stateless functional components don't have refs, so if you wrap one of those you can't provide a ref