You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know this has been discussed in various places in the past, specifically requesting that @gaearon add it to redux IIRC. I know the reasoning behind not using something like this is somewhat sound and this is a topic that doesn't really have a perfect solution at this time... but what other "drawbacks" can you guys think of to a package to hoist-non-react-methods when utilizing HOC?
The way I was previously doing it doesn't work with React16 / Fiber so I've recently had to rewrite it a bit and move the logic into componentDidMount and use a ref of the child rather than the component prototype... but it appears to do the job well enough.
Want to make sure I am not forgetting something significant, especially with how Fiber works.
Obviously using this heavily wouldn't be a good idea, but in this case it is a HOC which largely should be invisible in its implementation (simply injecting a prop). Changing how passing refs works simply didn't seem to be an appropriate solution.
Obviously it isn't ideal... just trying to consider the best way to implement a more transparent way of handling this.
So far the only real problem I can see with the implementation would be methods which are not present on the child at the time of mounting... which I think is acceptable drawback. I would think it wouldn't be too hard to adjust for that situation as well though?
The text was updated successfully, but these errors were encountered:
I know this has been discussed in various places in the past, specifically requesting that @gaearon add it to redux IIRC. I know the reasoning behind not using something like this is somewhat sound and this is a topic that doesn't really have a perfect solution at this time... but what other "drawbacks" can you guys think of to a package to
hoist-non-react-methods
when utilizing HOC?The way I was previously doing it doesn't work with React16 / Fiber so I've recently had to rewrite it a bit and move the logic into
componentDidMount
and use a ref of the child rather than the component prototype... but it appears to do the job well enough.Want to make sure I am not forgetting something significant, especially with how Fiber works.
Obviously using this heavily wouldn't be a good idea, but in this case it is a HOC which largely should be invisible in its implementation (simply injecting a prop). Changing how passing refs works simply didn't seem to be an appropriate solution.
https://gist.github.com/bradennapier/5a61c77318b075cf0e4bc207c40faba8
Where the implementation would look something like this:
https://gist.github.com/bradennapier/59192f736bf1c4d77a4cda8a7532facf
Obviously it isn't ideal... just trying to consider the best way to implement a more transparent way of handling this.
So far the only real problem I can see with the implementation would be methods which are not present on the child at the time of mounting... which I think is acceptable drawback. I would think it wouldn't be too hard to adjust for that situation as well though?
The text was updated successfully, but these errors were encountered: